1.3.0 #122
This file contains 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: tag-release | |
on: | |
push: | |
branches: | |
- dev | |
- main | |
jobs: | |
create-tag: | |
# NOTE: only trigger the workflow when the commit is not from the GitHubActions bot (prevent self-triggering) | |
if: github.event.commits[0].author.name != 'github-actions[bot]' | |
runs-on: ubuntu-latest | |
concurrency: release | |
environment: DEV | |
permissions: | |
contents: write | |
steps: | |
# NOTE: commits using GITHUB_TOKEN does not trigger workflows and we want to trigger PiPY from tag | |
- uses: actions/create-github-app-token@v1 | |
id: trigger-token | |
with: | |
app-id: ${{ vars.TRIGGER_WORKFLOW_GH_APP_ID}} | |
private-key: ${{ secrets.TRIGGER_WORKFLOW_GH_APP_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
repository: opentargets/gentroutils | |
token: ${{ secrets.GITHUB_TOKEN }} | |
persist-credentials: false | |
ref: ${{ github.ref_name }} | |
- name: Create package release | |
id: semrelease | |
# v9.6.0 is required due to the python v3.12 in the newer version of semantic release action which | |
# breaks the poetry build command. | |
uses: python-semantic-release/python-semantic-release@v9.19.1 | |
with: | |
github_token: ${{ steps.trigger-token.outputs.token }} | |
- name: Publish package to GitHub Release | |
uses: python-semantic-release/publish-action@v9.19.1 | |
if: ${{ steps.semrelease.outputs.released }} == 'true' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ steps.semrelease.outputs.tag }} | |
- name: Sync dev and main branch | |
if: ${{ github.ref_name == 'main' }} | |
shell: bash | |
run: | | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
git checkout dev | |
git merge main | |
- name: Push changes | |
if: ${{ github.ref_name == 'main' }} | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ steps.trigger-token.outcome.token }} | |
branch: dev |