Skip to content

Commit 1cdcd13

Browse files
committed
chore: fix workflows again
1 parent 827a0f1 commit 1cdcd13

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
required: true
99
type: string
1010
prerelease:
11-
description: Mark the GitHub release as a prerelease and skip the major tag update
11+
description: Mark the GitHub release as a prerelease and skip moving action tag updates
1212
required: false
1313
default: false
1414
type: boolean
@@ -79,10 +79,15 @@ jobs:
7979
fi
8080
8181
version_without_prefix="${RELEASE_VERSION#v}"
82-
major_version="v${version_without_prefix%%.*}"
82+
major="${version_without_prefix%%.*}"
83+
remaining="${version_without_prefix#*.}"
84+
minor="${remaining%%.*}"
85+
major_version="v$major"
86+
minor_version="v$major.$minor"
8387
8488
echo "version=$RELEASE_VERSION" >> "$GITHUB_OUTPUT"
8589
echo "major=$major_version" >> "$GITHUB_OUTPUT"
90+
echo "minor=$minor_version" >> "$GITHUB_OUTPUT"
8691
shell: bash
8792

8893
- name: Create immutable version tag
@@ -94,12 +99,15 @@ jobs:
9499
git push origin "refs/tags/$RELEASE_VERSION"
95100
shell: bash
96101

97-
- name: Update major version tag
102+
- name: Update moving action tags
98103
if: ${{ !inputs.prerelease }}
99104
env:
100105
MAJOR_VERSION: ${{ steps.release.outputs.major }}
106+
MINOR_VERSION: ${{ steps.release.outputs.minor }}
101107
run: |
102108
set -euo pipefail
109+
git tag -f "$MINOR_VERSION" "$GITHUB_SHA"
110+
git push --force origin "refs/tags/$MINOR_VERSION"
103111
git tag -f "$MAJOR_VERSION" "$GITHUB_SHA"
104112
git push --force origin "refs/tags/$MAJOR_VERSION"
105113
shell: bash

test/workflows.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@ describe('GitHub workflows', () => {
2323
expect(source).toContain('./actionlint -color')
2424
})
2525

26-
test('release workflow publishes immutable and major action tags', async () => {
26+
test('release workflow publishes immutable, major, and minor action tags', async () => {
2727
const { source, workflow } = await readWorkflow('release.yml')
2828

2929
expect(workflow.name).toBe('Release')
3030
expect(source).toContain('args=(release create "$RELEASE_VERSION"')
3131
expect(source).toContain('gh "${args[@]}"')
3232
expect(source).toContain('git tag "$RELEASE_VERSION" "$GITHUB_SHA"')
3333
expect(source).toContain('git tag -f "$MAJOR_VERSION" "$GITHUB_SHA"')
34+
expect(source).toContain('git tag -f "$MINOR_VERSION" "$GITHUB_SHA"')
3435
expect(source).toContain('git push --force origin "refs/tags/$MAJOR_VERSION"')
36+
expect(source).toContain('git push --force origin "refs/tags/$MINOR_VERSION"')
3537
})
3638
})

0 commit comments

Comments
 (0)