Skip to content

Commit

Permalink
auto update version on release
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Heric committed Mar 8, 2024
1 parent be3ac4e commit d7774b3
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion .github/workflows/apollo-server-plugin-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:

jobs:
build:
name: Release Streamdal's Apollo Server Plugin
name: Tag and Release
if: ${{ !contains(github.event.head_commit.message, 'norelease') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
Expand All @@ -21,6 +22,43 @@ jobs:
- name: Install dependencies
run: npm install --force

- name: Generate new tag (dry run)
uses: mathieudutour/[email protected]
id: get_new_version
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
fetch_all_tags: true

- name: Update npm package version
run: |
npm --no-git-tag-version version ${{ steps.get_new_version.outputs.new_version }}
# We do this because other jobs might have written to the repo while this
# job was running and making local changes; without this pull step, we
# might run into an error when performing the auto-commit.
- name: Pull latest changes
run: |
git config user.name github-actions
git config user.email [email protected]
git pull --depth=10
- uses: stefanzweifel/git-auto-commit-action@v4
id: auto_commit
with:
commit_message: Bumped npm package version to ${{ steps.get_new_version.outputs.new_version }}

- name: Create tag
uses: mathieudutour/[email protected]
id: create_tag
with:
commit_sha: ${{ steps.auto_commit.outputs.commit_hash }}
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.get_new_version.outputs.new_version }}

- name: Build
run: npm run build

- name: Release to npm
run: npm publish --access public
env:
Expand Down

0 comments on commit d7774b3

Please sign in to comment.