ci: no more refs tags for us :( #13
Workflow file for this run
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
name: release | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
check-tag: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check tag format | |
run: | | |
if [[ ${{ github.ref_name }} =~ ^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$ ]]; then | |
echo "Tag format is valid: ${{ github.ref_name }}" | |
else | |
echo "Invalid tag format: ${{ github.ref_name }}" | |
exit 1 | |
fi | |
release-gh: | |
name: Release on GitHub | |
runs-on: ubuntu-latest | |
needs: check-tag | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download firewall build artifact | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
workflow: firewall-build.yml | |
workflow_conclusion: success | |
name: cerbero | |
path: firewall/ | |
- name: Release on GitHub | |
run: | | |
latest_tag=$(git describe --tags --abbrev=0) | |
is_prerelease=false | |
release_attachments="firewall/cerbero" | |
if [[ $latest_tag == *"alpha"* || $latest_tag == *"beta"* ]]; then | |
is_prerelease=true | |
fi | |
command="gh release create $(git describe --tags --abbrev=0) -t $(git describe --tags --abbrev=0) --target main --generate-notes" | |
if [ $is_prerelease = true ]; then | |
command="$command --prerelease" | |
fi | |
command="$command $release_attachments" | |
$command | |
env: | |
GITHUB_TOKEN: ${{ secrets.CUSTOM_TOKEN }} # A custom token is needed to chain workflows after this one (e.g. docker builds) | |