Skip to content

Commit f6d69a0

Browse files
author
Anket Satbhai
committed
feat: divided workflows into two job
1 parent c0203f6 commit f6d69a0

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

.github/workflows/release-major-tag.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ permissions:
99
contents: write
1010

1111
jobs:
12-
update-tag:
12+
check-tag:
1313
runs-on: ubuntu-latest
14+
outputs:
15+
valid: ${{ steps.check.outputs.valid }}
1416

1517
steps:
1618
- name: Check tag format
@@ -25,45 +27,43 @@ jobs:
2527
echo "Tag format valid"
2628
else
2729
echo "valid=false" >> $GITHUB_OUTPUT
28-
echo "Tag format invalid. Workflow will skip."
30+
echo "Tag format invalid"
2931
fi
3032
33+
update-major-tag:
34+
needs: check-tag
35+
if: needs.check-tag.outputs.valid == 'true'
36+
runs-on: ubuntu-latest
37+
38+
steps:
3139
- name: Checkout repo
32-
if: steps.check.outputs.valid == 'true'
3340
uses: actions/checkout@v4
3441
with:
3542
fetch-depth: 0
3643

3744
- name: Fetch tags
38-
if: steps.check.outputs.valid == 'true'
3945
run: git fetch --tags
4046

4147
- name: Configure git
42-
if: steps.check.outputs.valid == 'true'
4348
run: |
4449
git config user.name "github-actions[bot]"
4550
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
4651
4752
- name: Extract major version
48-
if: steps.check.outputs.valid == 'true'
4953
id: version
5054
run: |
5155
TAG=${{ github.event.release.tag_name }}
52-
5356
MAJOR=$(echo "$TAG" | cut -d. -f1)
5457
MAJOR_TAG="v$MAJOR"
5558
5659
echo "Major tag: $MAJOR_TAG"
57-
5860
echo "major_tag=$MAJOR_TAG" >> $GITHUB_OUTPUT
5961
6062
- name: Update major tag
61-
if: steps.check.outputs.valid == 'true'
6263
run: |
6364
git tag -f ${{ steps.version.outputs.major_tag }} ${{ github.event.release.tag_name }}
6465
6566
- name: Push major tag
66-
if: steps.check.outputs.valid == 'true'
6767
run: |
6868
git push origin ${{ steps.version.outputs.major_tag }} --force
6969
...

0 commit comments

Comments
 (0)