forked from symless/synergy-spark
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (57 loc) · 1.88 KB
/
create-tag.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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
submodules: true
- name: Read version file
id: current-version
run: echo "value=$(cat odin/VERSION)" | tee $GITHUB_OUTPUT
- name: Set stage to snapshot
id: override-stage
if: ${{ !startsWith(github.ref, 'refs/heads/release') }}
run: echo "value=snapshot" | tee $GITHUB_OUTPUT
- name: Get next snapshot version
id: next-version
if: ${{ !startsWith(github.ref, 'refs/heads/release') }}
uses: symless/actions/next-version@master
with:
current-version: ${{ steps.current-version.outputs.value }}
override-stage: ${{ steps.override-stage.outputs.value }}
- name: Get version
id: version
run: |
if [[ -z "${{ steps.next-version.outputs.next-version }}" ]]; then
echo "value=${{ steps.current-version.outputs.value }}" | tee $GITHUB_OUTPUT
else
echo "value=${{ steps.next-version.outputs.next-version }}" | tee $GITHUB_OUTPUT
fi
shell: bash
- name: Create and push Git tag
run: |
git tag ${{ steps.version.outputs.value }}
git push origin ${{ steps.version.outputs.value }}
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.version.outputs.value }}'
});