This repository has been archived by the owner on Sep 23, 2024. It is now read-only.
Use GitHub vars to determine custom runner names (#7509) #6
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: Create tag | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- release/** | |
jobs: | |
create-tag: | |
if: ${{ vars.CREATE_TAGS }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Fetch all tags | |
fetch-depth: 0 | |
- name: Read version file | |
run: echo "CURRENT_VERSION=$(cat VERSION)" >> $GITHUB_ENV | |
- name: Override stage | |
if: ${{ !startsWith(github.ref, 'refs/heads/release') }} | |
run: echo "OVERRIDE_STAGE=snapshot" >> $GITHUB_ENV | |
- name: Get next version | |
id: next-version | |
uses: symless/actions/next-version@master | |
with: | |
current-version: ${{ env.CURRENT_VERSION }} | |
override-stage: ${{ env.OVERRIDE_STAGE }} | |
- name: Create and push Git tag | |
run: | | |
git tag ${{ steps.next-version.outputs.next-version }} | |
git push origin ${{ steps.next-version.outputs.next-version }} | |
shell: bash | |
- name: Trigger CI workflow | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
await github.rest.actions.createWorkflowDispatch({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
workflow_id: 'ci.yml', | |
ref: '${{ steps.next-version.outputs.next-version }}' | |
}); |