Skip to content

Commit

Permalink
Add tag_release workflow pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
gMonty committed Jul 18, 2024
1 parent 892ef12 commit dd78cd0
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/tag_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Create Github Release

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

# Permission can be added at job level or workflow level
permissions:
contents: write # This is required for actions/checkout and create release

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
name: Github Release
runs-on: ubuntu-latest

steps:
- name: Create Github Release
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
if (!${{ toJson(github.ref_name) }}) {
core.setFailed("RELEASE_TAG is not defined.")
return;
}
try {
const response = await github.rest.repos.createRelease({
name: ${{ toJson(github.ref_name) }},
tag_name: ${{ toJson(github.ref_name) }},
draft: false,
generate_release_notes: true,
owner: context.repo.owner,
prerelease: false,
repo: context.repo.repo,
});
core.exportVariable('RELEASE_ID', response.data.id);
core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url);
} catch (error) {
core.setFailed(error.message);
}

0 comments on commit dd78cd0

Please sign in to comment.