Release #3
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
# Code generated by craft; DO NOT EDIT. | |
name: Release | |
run-name: Release | |
on: | |
push: | |
branches: | |
- main | |
- master | |
- staging | |
- dev | |
- develop | |
- development | |
- next | |
- beta | |
- alpha | |
- v[0-9]+.x | |
- v[0-9]+.[0-9]+.x | |
workflow_dispatch: | |
inputs: | |
dry_run: | |
description: Dry run | |
type: boolean | |
default: false | |
jobs: | |
version: | |
name: Version | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.release.outputs.version }} | |
release: ${{ steps.release.outputs.release }} | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
# https://github.com/marketplace/actions/action-for-semantic-release | |
- id: semantic_release | |
continue-on-error: true | |
uses: cycjimmy/semantic-release-action@v4 | |
with: | |
semantic_version: 23 | |
extra_plugins: | | |
@semantic-release/changelog | |
@semantic-release/commit-analyzer | |
@semantic-release/exec | |
@semantic-release/git | |
@semantic-release/github | |
@semantic-release/release-notes-generator | |
conventional-changelog-conventionalcommits@7 | |
semantic-release-license | |
dry_run: true | |
tag_format: v${version} | |
branches: | | |
[ | |
"(master|main)", | |
"v+([0-9])?(.{+([0-9]),x}).x", | |
{ "name": "next", "prerelease": true }, | |
{ "name": "beta", "prerelease": true }, | |
{ "name": "alpha", "prerelease": true }, | |
{ "name": "staging", "prerelease": "beta" }, | |
{ "name": "(dev|develop|development)", "prerelease": "alpha" } | |
] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- id: release | |
run: | | |
SHA=$(echo "${GITHUB_REF_NAME}" | sha256sum | cut -c -8) | |
if echo "$SEMREL_INFO_NEXT_VERSION" | grep -Eq "^[0-9]+(\.[0-9]+){2}.*$"; then | |
echo "version=v$SEMREL_INFO_NEXT_VERSION" >> $GITHUB_OUTPUT | |
echo "$SEMREL_INFO_NEXT_VERSION" | grep -Eq "^[0-9]+(\.[0-9]+){2}$" && echo "release=true" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
git fetch --tags | |
SEARCH="" # see .gitlab/version.yml.tmpl - may evolve in the future | |
SEMREL_INFO_LAST_VERSION=$(git tag --list | sort -V | grep -E "${SEARCH}" | tail -n1) | |
SEMREL_INFO_NEXT_VERSION=${SEMREL_INFO_LAST_VERSION-1.0.0} | |
SEMREL_INFO_NEXT_VERSION=${SEMREL_INFO_NEXT_VERSION%-*} | |
echo "version=v${SEMREL_INFO_NEXT_VERSION#v}-build.${SHA}" >> $GITHUB_OUTPUT | |
env: | |
SEMREL_INFO_LAST_VERSION: ${{ steps.semantic_release.outputs.last_release_version }} | |
SEMREL_INFO_NEXT_VERSION: ${{ steps.semantic_release.outputs.new_release_version }} | |
- run: echo $VERSION | |
env: | |
VERSION: ${{ steps.release.outputs.version }} | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: github.ref_protected == true | |
environment: release | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
# https://github.com/marketplace/actions/action-for-semantic-release | |
- id: semantic-release | |
uses: cycjimmy/semantic-release-action@v4 | |
with: | |
semantic_version: 23 | |
extra_plugins: | | |
@semantic-release/changelog | |
@semantic-release/commit-analyzer | |
@semantic-release/exec | |
@semantic-release/git | |
@semantic-release/github | |
@semantic-release/release-notes-generator | |
conventional-changelog-conventionalcommits@7 | |
semantic-release-license | |
dry_run: ${{ inputs.dry_run }} | |
tag_format: v${version} | |
branches: | | |
[ | |
"(master|main)", | |
"v+([0-9])?(.{+([0-9]),x}).x", | |
{ "name": "next", "prerelease": true }, | |
{ "name": "beta", "prerelease": true }, | |
{ "name": "alpha", "prerelease": true }, | |
{ "name": "staging", "prerelease": "beta" }, | |
{ "name": "(dev|develop|development)", "prerelease": "alpha" } | |
] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |