diff --git a/.github/workflows/publish-github-packages.yml b/.github/workflows/publish-github-packages.yml new file mode 100644 index 00000000..6b7c5a23 --- /dev/null +++ b/.github/workflows/publish-github-packages.yml @@ -0,0 +1,68 @@ +name: Publish to Github Packages + +on: + workflow_dispatch: + inputs: + packageVersion: + description: "The version to publish (e.g. prerelease, patch, major, new-version 1.2.3)" + required: true + default: "prerelease" + distTag: + description: "The dist-tag to publish (e.g. latest, beta)" + required: true + default: "latest" + +jobs: + authorize: + name: Authorize + runs-on: ubuntu-latest + steps: + - name: ${{ github.actor }} permission check to do a release + uses: "lannonbr/repo-permission-check-action@2.0.2" + with: + permission: "write" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + release: + name: Publish to Github Packages + runs-on: ubuntu-latest + needs: [authorize] + env: + PACKAGE_VERSION: ${{ github.event.inputs.packageVersion }} + DIST_TAG: ${{ github.event.inputs.distTag }} + strategy: + matrix: + node-version: [ 14.x ] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + + - name: Install + run: yarn install --frozen-lockfile + + - name: Build + run: yarn build + + - name: Lint + run: yarn lint + + - name: Test + run: yarn test + + - name: Set registry url + uses: actions/setup-node@v2 + with: + registry-url: 'https://npm.pkg.github.com' + + - name: Publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + yarn publish --${{ env.PACKAGE_VERSION }} --tag ${{ env.DIST_TAG }} --no-git-tag-version