Update publish.yml #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish | ||
| on: | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: write | ||
| workflows: write | ||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 18 | ||
| cache: 'npm' | ||
| - run: | | ||
| git config user.name "${GITHUB_ACTOR}" | ||
| git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
| - run: echo "NPM_PACKAGE_VERSION=$(npm version patch --no-git-tag-version)" | tee -a $GITHUB_ENV | ||
| - run: echo "NPM_PACKAGE_VERSION_MAJOR=$(echo "${{ env.NPM_PACKAGE_VERSION }}" | cut -d. -f1)" | tee -a $GITHUB_ENV | ||
| - run: | | ||
| sed -i "s|\(uses:[[:space:]]*forproxyband/vector-code-map@\)v[0-9.]*|\1${{ env.NPM_PACKAGE_VERSION }}|g" README.md | ||
| - run: | | ||
| sed -i "s|\(uses:[[:space:]]*forproxyband/vector-code-map@\)v[0-9.]*|\1${{ env.NPM_PACKAGE_VERSION }}|g" .github/workflows/update-vector-map.yml | ||
| - run: git add package.json package-lock.json README.md .github/workflows/update-vector-map.yml | ||
| - run: | | ||
| git commit -m "Set version ${{ env.NPM_PACKAGE_VERSION }} by ${GITHUB_ACTOR}" | ||
| git push -u origin main | ||
| git tag -fa ${{ env.NPM_PACKAGE_VERSION_MAJOR }} -m "Add major tag ${{ env.NPM_PACKAGE_VERSION_MAJOR }}" | ||
| git push origin ${{ env.NPM_PACKAGE_VERSION_MAJOR }} --force | ||
| git tag -a ${{ env.NPM_PACKAGE_VERSION }} -m "Add tag ${{ env.NPM_PACKAGE_VERSION }}" | ||
| git push origin ${{ env.NPM_PACKAGE_VERSION }} | ||
| env: | ||
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||