diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1bb2b0e..9d3f161 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -8,8 +8,7 @@ env: push: branches: - main - tags: - - 'v*' + - 'release/*' pull_request: null concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -153,10 +152,9 @@ jobs: run: cargo test publish: name: Publish - if: startsWith(github.ref, 'refs/tags/v') + if: startsWith(github.ref, 'refs/heads/release/') runs-on: ubuntu-latest permissions: - contents: write id-token: write needs: - lint @@ -180,31 +178,13 @@ jobs: run: yarn artifacts - name: Determine version and tag run: | - VERSION="${GITHUB_REF_NAME#v}" + VERSION=$(node -p "require('./package.json').version") + NPM_TAG="${GITHUB_REF_NAME#release/}" echo "VERSION=$VERSION" >> $GITHUB_ENV - if echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z]+\.[0-9]+)?$'; then - if echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then - echo "NPM_TAG=latest" >> $GITHUB_ENV - else - echo "NPM_TAG=next" >> $GITHUB_ENV - fi - else - echo "NPM_TAG=latest" >> $GITHUB_ENV - fi + echo "NPM_TAG=$NPM_TAG" >> $GITHUB_ENV - name: Publish to npm run: | echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc npm publish --access public --tag ${{ env.NPM_TAG }} env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Create GitHub Release - uses: softprops/action-gh-release@v2 - with: - name: v${{ env.VERSION }} - tag_name: ${{ github.ref_name }} - prerelease: ${{ env.NPM_TAG == 'next' }} - files: | - artifacts/oxrls-*/ - generate_release_notes: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}