diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index bf278cf..0c413ed 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -5,6 +5,7 @@ on: jobs: test: + name: Test Before Release uses: ./.github/workflows/test.yaml build: needs: test @@ -12,6 +13,9 @@ jobs: runs-on: ubuntu-latest permissions: packages: write + + env: + TAG: ${{ github.event.release.prerelease == true && 'pre-release' }} ${{ github.event.release.prerelease == false || startsWith(github.event.release.tag_name, '0.') && 'latest' }} steps: - name: Checkout uses: actions/checkout@v3 @@ -34,17 +38,21 @@ jobs: token: ${{ secrets.NPM_ACCESS_TOKEN }} registry: https://registry.npmjs.org/ check-version: true + tag: ${{ env.TAG }} + - uses: jossef/action-set-json-field@v2 name: "Change Package Name for GitHub" with: file: package.json field: name value: "@${{ github.repository_owner }}/${{ github.event.repository.name }}" + - uses: JS-DevTools/npm-publish@v1 name: "Publish to GitHub Packages Registry" with: token: ${{ secrets.GITHUB_TOKEN }} registry: https://npm.pkg.github.com check-version: true + tag: ${{ env.TAG }}