Skip to content

Commit f13f541

Browse files
authored
Remove + recreate major and minor versions (#52)
1 parent 7a013ba commit f13f541

File tree

2 files changed

+39
-19
lines changed

2 files changed

+39
-19
lines changed

.github/workflows/auto-git-release-production.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#
55
# See https://github.com/PaulHatch/semantic-version https://github.com/PaulHatch/semantic-version/tree/v5.0.2
66
# See https://github.com/softprops/action-gh-release https://github.com/softprops/action-gh-release/tree/v1
7-
# See https://github.com/Actions-R-Us/actions-tagger https://github.com/Actions-R-Us/actions-tagger/releases/tag/v2.0.3
87

98
name: 'Auto release'
109
on:
@@ -21,6 +20,8 @@ jobs:
2120
with:
2221
fetch-depth: 0 # Force fetch all commits - See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action
2322

23+
- run: "echo \"GITHUB_SHA: ${{ github.sha }}\""
24+
2425
# Outputs documentation: https://github.com/PaulHatch/semantic-version/blob/master/src/main.ts#L22-L33
2526
- name: Resolving next Release Candidate version using semantic-version
2627
uses: paulhatch/[email protected]
@@ -56,7 +57,7 @@ jobs:
5657
--title "${{steps.next_semantic_version.outputs.version_tag}}" \
5758
--latest \
5859
--generate-notes \
59-
--target $GITHUB_SHA
60+
--target "${{github.sha}}"
6061
env:
6162
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
6263

@@ -76,17 +77,21 @@ jobs:
7677
gh release create v${{steps.next_semantic_version.outputs.major}} \
7778
--title "v${{steps.next_semantic_version.outputs.major}} MAJOR release (auto-updated)" \
7879
--generate-notes \
79-
--target $GITHUB_SHA
80+
--target "${{github.sha}}"
8081
env:
8182
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
8283

8384
# See https://cli.github.com/manual/gh_release_edit
84-
- name: Updating existing release for the major "v${{steps.next_semantic_version.outputs.major}}" version
85+
- name: Recreating existing release for the major "v${{steps.next_semantic_version.outputs.major}}" version
8586
if: ${{ steps.majorTagExists.outputs.exists == 'true' }}
8687
run: |
87-
gh release edit v${{steps.next_semantic_version.outputs.major}} \
88+
# Delete and create the release again
89+
gh release delete v${{steps.next_semantic_version.outputs.major}} --cleanup-tag --yes
90+
91+
gh release create v${{steps.next_semantic_version.outputs.major}} \
8892
--title "v${{steps.next_semantic_version.outputs.major}} MAJOR release (auto-updated)" \
89-
--target $GITHUB_SHA
93+
--generate-notes \
94+
--target "${{github.sha}}"
9095
env:
9196
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
9297

@@ -106,16 +111,20 @@ jobs:
106111
gh release create v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} \
107112
--title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} MINOR release (auto-updated)" \
108113
--generate-notes \
109-
--target $GITHUB_SHA
114+
--target "${{github.sha}}"
110115
env:
111116
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
112117

113118
# See https://cli.github.com/manual/gh_release_edit
114-
- name: Updating existing release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}" version
119+
- name: Recreating existing release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}" version
115120
if: ${{ steps.minorTagExists.outputs.exists == 'true' }}
116121
run: |
117-
gh release edit v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} \
122+
# Delete and create the release again
123+
gh release delete v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} --cleanup-tag --yes
124+
125+
gh release create v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} \
118126
--title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} MINOR release (auto-updated)" \
119-
--target $GITHUB_SHA
127+
--generate-notes \
128+
--target "${{github.sha}}"
120129
env:
121130
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/auto-git-release-staging.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ jobs:
1515
tag-and-release:
1616
runs-on: ubuntu-22.04
1717
steps:
18-
- uses: actions/checkout@v3
18+
- name: Fetching all commits for the current branch
19+
uses: actions/checkout@v3
1920
with:
2021
fetch-depth: 0 # Force fetch all commits - See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action
2122

23+
- run: "echo \"GITHUB_SHA: ${{ github.sha }}\""
24+
2225
# Outputs documentation: https://github.com/PaulHatch/semantic-version/blob/master/src/main.ts#L22-L33
2326
- name: Resolving next Release Candidate version using semantic-version
2427
uses: paulhatch/[email protected]
@@ -65,18 +68,22 @@ jobs:
6568
--title "v${{steps.next_semantic_version.outputs.major}}-rc MAJOR release (auto-updated)" \
6669
--generate-notes \
6770
--prerelease \
68-
--target $GITHUB_SHA
71+
--target "${{github.sha}}"
6972
env:
7073
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
7174

7275
# See https://cli.github.com/manual/gh_release_edit
73-
- name: Updating existing release for the major "v${{steps.next_semantic_version.outputs.major}}-rc" version
76+
- name: Recreating existing release for the major "v${{steps.next_semantic_version.outputs.major}}-rc" version
7477
if: ${{ steps.majorTagExists.outputs.exists == 'true' }}
7578
run: |
76-
gh release edit v${{steps.next_semantic_version.outputs.major}}-rc \
79+
# Delete and create the release again
80+
gh release delete v${{steps.next_semantic_version.outputs.major}}-rc --cleanup-tag --yes
81+
82+
gh release create v${{steps.next_semantic_version.outputs.major}}-rc \
7783
--title "v${{steps.next_semantic_version.outputs.major}}-rc MAJOR release (auto-updated)" \
84+
--generate-notes \
7885
--prerelease \
79-
--target $GITHUB_SHA
86+
--target "${{github.sha}}"
8087
env:
8188
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
8289

@@ -97,17 +104,21 @@ jobs:
97104
--title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc MINOR release (auto-updated)" \
98105
--generate-notes \
99106
--prerelease \
100-
--target $GITHUB_SHA
107+
--target "${{github.sha}}"
101108
env:
102109
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
103110

104111
# See https://cli.github.com/manual/gh_release_edit
105-
- name: Updating existing release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc" version
112+
- name: Recreating existing release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc" version
106113
if: ${{ steps.minorTagExists.outputs.exists == 'true' }}
107114
run: |
108-
gh release edit v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc \
115+
# Delete and create the release again
116+
gh release delete v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc --cleanup-tag --yes
117+
118+
gh release create v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc \
109119
--title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc MINOR release (auto-updated)" \
120+
--generate-notes \
110121
--prerelease \
111-
--target $GITHUB_SHA
122+
--target "${{github.sha}}"
112123
env:
113124
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

0 commit comments

Comments
 (0)