Skip to content

Commit

Permalink
Restore create tags
Browse files Browse the repository at this point in the history
  • Loading branch information
nbolton committed Oct 15, 2024
1 parent a27869c commit 56b901f
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/create-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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 }}'
});

0 comments on commit 56b901f

Please sign in to comment.