-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add auto-releasing for MINOR versions + fix auto-releasing for MAJOR … (
#92)
- Loading branch information
1 parent
807a860
commit 241f033
Showing
4 changed files
with
165 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# Summary: | ||
# Automatically tag and release when changes land on the "main" branch. | ||
# It uses "semantic-version" to resolve the next version to use, and then we use GitHub CLI to create or update the releases. | ||
# | ||
# See https://github.com/PaulHatch/semantic-version https://github.com/PaulHatch/semantic-version/tree/v5.0.2 | ||
# See https://github.com/softprops/action-gh-release https://github.com/softprops/action-gh-release/tree/v1 | ||
# See https://github.com/Actions-R-Us/actions-tagger https://github.com/Actions-R-Us/actions-tagger/releases/tag/v2.0.3 | ||
|
||
name: 'Auto release' | ||
on: | ||
|
@@ -49,34 +51,71 @@ jobs: | |
echo "current_commit: ${{steps.next_semantic_version.outputs.current_commit}}" | ||
- name: Creating Git release tag for the "${{steps.next_semantic_version.outputs.version_tag}}" version | ||
uses: softprops/action-gh-release@v1 | ||
with: # See https://github.com/softprops/action-gh-release#-customizing | ||
token: "${{ secrets.GITHUB_TOKEN }}" | ||
tag_name: ${{steps.next_semantic_version.outputs.version_tag}} | ||
name: "Automatic release ${{steps.next_semantic_version.outputs.version_tag}}" | ||
prerelease: false | ||
generate_release_notes: true | ||
files: | | ||
CHANGELOG.md | ||
run: | | ||
gh release create ${{steps.next_semantic_version.outputs.version_tag}} \ | ||
--title "${{steps.next_semantic_version.outputs.version_tag}}" \ | ||
--latest \ | ||
--generate-notes \ | ||
--target $GITHUB_SHA | ||
env: | ||
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
# Check if the major version already exists (if it doesn't, we'll create it - if it does, we'll update it) | ||
- name: Check if tag "v${{steps.next_semantic_version.outputs.major}}" exists | ||
uses: mukunku/[email protected] | ||
id: majorTagExists | ||
with: # See https://github.com/mukunku/tag-exists-action#inputs | ||
tag: "v${{steps.next_semantic_version.outputs.major}}" | ||
|
||
- run: "echo \"Check if majorTagExists: ${{ steps.majorTagExists.outputs.exists }}\"" | ||
|
||
- name: Updating Git release tag for "latest" version | ||
uses: softprops/action-gh-release@v1 | ||
with: # See https://github.com/softprops/action-gh-release#-customizing | ||
token: "${{ secrets.GITHUB_TOKEN }}" | ||
tag_name: latest | ||
name: "Latest release (auto-update) - UNSAFE for production usage" | ||
prerelease: false | ||
generate_release_notes: true | ||
files: | | ||
CHANGELOG.md | ||
# See https://cli.github.com/manual/gh_release_create | ||
- name: Creating new release for the major "v${{steps.next_semantic_version.outputs.major}}" version | ||
if: ${{ steps.majorTagExists.outputs.exists == 'false' }} | ||
run: | | ||
gh release create v${{steps.next_semantic_version.outputs.major}} \ | ||
--title "v${{steps.next_semantic_version.outputs.major}} MAJOR release (auto-updated)" \ | ||
--generate-notes \ | ||
--target $GITHUB_SHA | ||
env: | ||
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
# See https://cli.github.com/manual/gh_release_edit | ||
- name: Updating existing release for the major "v${{steps.next_semantic_version.outputs.major}}" version | ||
if: ${{ steps.majorTagExists.outputs.exists == 'true' }} | ||
run: | | ||
gh release edit v${{steps.next_semantic_version.outputs.major}} \ | ||
--title "v${{steps.next_semantic_version.outputs.major}} MAJOR release (auto-updated)" \ | ||
--target $GITHUB_SHA | ||
env: | ||
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
- name: Updating Git release tag for the major "v${{steps.next_semantic_version.outputs.major}}" version | ||
uses: softprops/action-gh-release@v1 | ||
with: # See https://github.com/softprops/action-gh-release#-customizing | ||
token: "${{ secrets.GITHUB_TOKEN }}" | ||
tag_name: "v${{steps.next_semantic_version.outputs.major}}" | ||
name: "v${{steps.next_semantic_version.outputs.major}} latest release (auto-update)" | ||
prerelease: false | ||
generate_release_notes: true | ||
files: | | ||
CHANGELOG.md | ||
# Check if the minor version already exists (if it doesn't, we'll create it - if it does, we'll update it) | ||
- name: Check if tag "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}" exists | ||
uses: mukunku/[email protected] | ||
id: minorTagExists | ||
with: # See https://github.com/mukunku/tag-exists-action#inputs | ||
tag: "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}" | ||
|
||
- run: "echo \"Check if minorTagExists: ${{ steps.minorTagExists.outputs.exists }}\"" | ||
|
||
# See https://cli.github.com/manual/gh_release_create | ||
- name: Creating new release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}" version | ||
if: ${{ steps.minorTagExists.outputs.exists == 'false' }} | ||
run: | | ||
gh release create v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} \ | ||
--title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} MINOR release (auto-updated)" \ | ||
--generate-notes \ | ||
--target $GITHUB_SHA | ||
env: | ||
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
# See https://cli.github.com/manual/gh_release_edit | ||
- name: Updating existing release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}" version | ||
if: ${{ steps.minorTagExists.outputs.exists == 'true' }} | ||
run: | | ||
gh release edit v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} \ | ||
--title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} MINOR release (auto-updated)" \ | ||
--target $GITHUB_SHA | ||
env: | ||
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Summary: | ||
# Automatically tag and release when changes land on the "main" branch. | ||
# It uses "semantic-version" to resolve the next version to use, and then we use GitHub CLI to create or update the releases. | ||
# | ||
# See https://github.com/PaulHatch/semantic-version https://github.com/PaulHatch/semantic-version/tree/v5.0.2 | ||
# See https://github.com/softprops/action-gh-release https://github.com/softprops/action-gh-release/tree/v1 | ||
|
@@ -47,35 +48,66 @@ jobs: | |
echo "previous_commit: ${{steps.next_semantic_version.outputs.previous_commit}}" | ||
echo "current_commit: ${{steps.next_semantic_version.outputs.current_commit}}" | ||
- name: Creating Git release tag for the "v${{steps.next_semantic_version.outputs.version}}" version | ||
uses: softprops/action-gh-release@v1 | ||
with: # See https://github.com/softprops/action-gh-release#-customizing | ||
token: "${{ secrets.GITHUB_TOKEN }}" | ||
tag_name: "v${{steps.next_semantic_version.outputs.version}}" | ||
name: "Automatic release v${{steps.next_semantic_version.outputs.version}}" | ||
prerelease: true | ||
generate_release_notes: true | ||
files: | | ||
CHANGELOG.md | ||
# Check if the major version already exists (if it doesn't, we'll create it - if it does, we'll update it) | ||
- name: Check if tag "v${{steps.next_semantic_version.outputs.major}}-rc" exists | ||
uses: mukunku/[email protected] | ||
id: majorTagExists | ||
with: # See https://github.com/mukunku/tag-exists-action#inputs | ||
tag: "v${{steps.next_semantic_version.outputs.major}}-rc" | ||
|
||
- name: Updating Git release tag for "latest-rc" version | ||
uses: softprops/action-gh-release@v1 | ||
with: # See https://github.com/softprops/action-gh-release#-customizing | ||
token: "${{ secrets.GITHUB_TOKEN }}" | ||
tag_name: latest-rc | ||
name: "Latest release (auto-update) - UNSAFE for production usage" | ||
prerelease: true | ||
generate_release_notes: true | ||
files: | | ||
CHANGELOG.md | ||
- run: "echo \"Check if majorTagExists: ${{ steps.majorTagExists.outputs.exists }}\"" | ||
|
||
- name: Updating Git release tag for the major "v${{steps.next_semantic_version.outputs.major}}-rc" version | ||
uses: softprops/action-gh-release@v1 | ||
with: # See https://github.com/softprops/action-gh-release#-customizing | ||
token: "${{ secrets.GITHUB_TOKEN }}" | ||
tag_name: "v${{steps.next_semantic_version.outputs.major}}-rc" | ||
name: "v${{steps.next_semantic_version.outputs.major}}-rc latest release (auto-update)" | ||
prerelease: true | ||
generate_release_notes: true | ||
files: | | ||
CHANGELOG.md | ||
# See https://cli.github.com/manual/gh_release_create | ||
- name: Creating new release for the major "v${{steps.next_semantic_version.outputs.major}}-rc" version | ||
if: ${{ steps.majorTagExists.outputs.exists == 'false' }} | ||
run: | | ||
gh release create v${{steps.next_semantic_version.outputs.major}}-rc \ | ||
--title "v${{steps.next_semantic_version.outputs.major}}-rc MAJOR release (auto-updated)" \ | ||
--generate-notes \ | ||
--prerelease \ | ||
--target $GITHUB_SHA | ||
env: | ||
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
# See https://cli.github.com/manual/gh_release_edit | ||
- name: Updating existing release for the major "v${{steps.next_semantic_version.outputs.major}}-rc" version | ||
if: ${{ steps.majorTagExists.outputs.exists == 'true' }} | ||
run: | | ||
gh release edit v${{steps.next_semantic_version.outputs.major}}-rc \ | ||
--title "v${{steps.next_semantic_version.outputs.major}}-rc MAJOR release (auto-updated)" \ | ||
--prerelease \ | ||
--target $GITHUB_SHA | ||
env: | ||
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
# Check if the minor version already exists (if it doesn't, we'll create it - if it does, we'll update it) | ||
- name: Check if tag "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc" exists | ||
uses: mukunku/[email protected] | ||
id: minorTagExists | ||
with: # See https://github.com/mukunku/tag-exists-action#inputs | ||
tag: "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc" | ||
|
||
- run: "echo \"Check if minorTagExists: ${{ steps.minorTagExists.outputs.exists }}\"" | ||
|
||
# See https://cli.github.com/manual/gh_release_create | ||
- name: Creating new release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc" version | ||
if: ${{ steps.minorTagExists.outputs.exists == 'false' }} | ||
run: | | ||
gh release create v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc \ | ||
--title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc MINOR release (auto-updated)" \ | ||
--generate-notes \ | ||
--prerelease \ | ||
--target $GITHUB_SHA | ||
env: | ||
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
# See https://cli.github.com/manual/gh_release_edit | ||
- name: Updating existing release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc" version | ||
if: ${{ steps.minorTagExists.outputs.exists == 'true' }} | ||
run: | | ||
gh release edit v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc \ | ||
--title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc MINOR release (auto-updated)" \ | ||
--prerelease \ | ||
--target $GITHUB_SHA | ||
env: | ||
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters