Merge pull request #12 from opentargets/dev #9
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 | |
"on": | |
push: | |
branches: ["main"] | |
concurrency: | |
group: deploy | |
# NOTE: prevent hickups with semantic-release | |
cancel-in-progress: false | |
env: | |
PYTHON_VERSION_DEFAULT: "3.10.8" | |
jobs: | |
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' | |
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: main | |
- name: Python Semantic 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/[email protected] | |
with: | |
github_token: ${{ steps.trigger-token.outputs.token }} | |
- name: Publish package to GitHub Release | |
uses: python-semantic-release/upload-to-gh-release@main | |
if: ${{ steps.semrelease.outputs.released }} == 'true' | |
with: | |
# NOTE: allow to start the workflow when push action on tag gets executed | |
# requires using GH_APP to authenitcate, otherwise push authorised with | |
# the GITHUB_TOKEN does not trigger the tag artifact workflow. | |
# see https://github.com/actions/create-github-app-token | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ steps.semrelease.outputs.tag }} |