Skip to content

Commit 5025509

Browse files
authored
fix: Run major tag workflow after changelog without duplicates (#390)
1 parent 55e9697 commit 5025509

4 files changed

Lines changed: 46 additions & 10 deletions

File tree

.github/workflows/release-changelog-internal.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,13 @@ jobs:
1515
release_tag: ${{ github.ref_name }}
1616
secrets:
1717
GITHUB: ${{ secrets.GITHUB }}
18+
19+
release-major-tag:
20+
needs: changelog
21+
if: always()
22+
uses: ./.github/workflows/release-maintain-major-tag.yml
23+
with:
24+
tag_name: ${{ github.ref_name }}
25+
secrets:
26+
GITHUB: ${{ secrets.GITHUB }}
1827
...

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22
name: Release - Maintain Major Tag
33

44
on:
5-
release:
6-
types: [published]
5+
workflow_call:
6+
inputs:
7+
tag_name:
8+
description: 'Tag name to update major version for'
9+
required: true
10+
type: string
11+
secrets:
12+
GITHUB:
13+
required: true
714

815
permissions:
916
contents: write
@@ -18,7 +25,7 @@ jobs:
1825
- name: Check tag format
1926
id: check
2027
run: |
21-
TAG=${{ github.event.release.tag_name }}
28+
TAG="${{ inputs.tag_name }}"
2229
2330
echo "Release tag: $TAG"
2431
@@ -40,6 +47,7 @@ jobs:
4047
uses: actions/checkout@v6
4148
with:
4249
fetch-depth: 0
50+
token: ${{ secrets.GITHUB }}
4351

4452
- name: Fetch tags
4553
run: git fetch --tags
@@ -52,7 +60,7 @@ jobs:
5260
- name: Extract major version
5361
id: version
5462
run: |
55-
TAG=${{ github.event.release.tag_name }}
63+
TAG="${{ inputs.tag_name }}"
5664
MAJOR=$(echo "$TAG" | cut -d. -f1)
5765
MAJOR_TAG="$MAJOR"
5866
@@ -61,7 +69,7 @@ jobs:
6169
6270
- name: Update major tag
6371
run: |
64-
git tag -f ${{ steps.version.outputs.major_tag }} ${{ github.event.release.tag_name }}
72+
git tag -f ${{ steps.version.outputs.major_tag }} ${{ inputs.tag_name }}
6573
6674
- name: Push major tag
6775
run: |

.github/workflows/tf-smurf.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: 🦸‍♂️ Smurf Terraform workflow
33
on:
44
workflow_call:
55
inputs:
6-
working_directory:
6+
terraform_directory:
77
required: true
88
type: string
99
description: 'Root directory of the terraform where all resources exist.'
@@ -35,8 +35,12 @@ on:
3535
description: 'Approvals list to approve apply or destroy'
3636
smurf_version:
3737
type: string
38-
default: v0.0.9
38+
default: latest
3939
description: 'Required Smurf version'
40+
terraform_version:
41+
type: string
42+
default: 1.3.6
43+
description: 'Required Terraform version'
4044
timeout:
4145
required: false
4246
type: number
@@ -177,6 +181,11 @@ jobs:
177181
with:
178182
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
179183

184+
- name: 🛠️ Set up Terraform
185+
uses: hashicorp/setup-terraform@v4
186+
with:
187+
terraform_version: ${{ inputs.terraform_version }}
188+
180189
- name: ⚙️ Set up Smurf Terraform
181190
uses: clouddrove/smurf@v1.1.3
182191

@@ -222,6 +231,11 @@ jobs:
222231
- name: 📦 Checkout Repository
223232
uses: actions/checkout@v6
224233

234+
- name: 🛠️ Set up Terraform
235+
uses: hashicorp/setup-terraform@v4
236+
with:
237+
terraform_version: ${{ inputs.terraform_version }}
238+
225239
- name: ⚙️ Set up Smurf Terraform
226240
uses: clouddrove/smurf@v1.1.3
227241

docs/release-maintain-major-tag.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ Example:
3131
The workflow runs when a **GitHub Release is published**.
3232

3333
```yaml
34-
on:
35-
release:
36-
types: [published]
34+
release-major-tag:
35+
needs: changelog
36+
if: always()
37+
uses: clouddrove/github-shared-workflows/.github/workflows/release-maintain-major-tag.yml
38+
with:
39+
tag_name: ${{ github.ref_name }}
40+
secrets:
41+
GITHUB: ${{ secrets.GITHUB }}

0 commit comments

Comments
 (0)