Skip to content

Commit

Permalink
Create/update tags with github-script.
Browse files Browse the repository at this point in the history
  • Loading branch information
dumptruckman committed Sep 12, 2024
1 parent c24aa0b commit e8ae072
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,39 @@ jobs:
echo "patch=$(echo $clean_version | cut -d. -f3)" >> $GITHUB_OUTPUT
- name: Update major version tag
uses: rickstaa/action-create-tag@v1
uses: actions/github-script@v7
with:
tag: v${{ steps.version-parts.outputs.major }}
force_push_tag: true
tag_exists_error: false
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/v${{ steps.version-parts.outputs.major }}',
sha: context.sha
}).catch(err => {
if (err.status !== 422) throw err;
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/v${{ steps.version-parts.outputs.major }}',
sha: context.sha
});
});
- name: Update minor version tag
uses: rickstaa/action-create-tag@v1
uses: actions/github-script@v7
with:
tag: v${{ steps.version-parts.outputs.major }}.${{ steps.version-parts.outputs.minor }}
force_push_tag: true
tag_exists_error: false
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/v${{ steps.version-parts.outputs.major }}.${{ steps.version-parts.outputs.minor }}',
sha: context.sha
}).catch(err => {
if (err.status !== 422) throw err;
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/v${{ steps.version-parts.outputs.major }}.${{ steps.version-parts.outputs.minor }}',
sha: context.sha
});
});

0 comments on commit e8ae072

Please sign in to comment.