Skip to content

Commit

Permalink
ci: check for tag format and add beta and alpha as possible image tag (
Browse files Browse the repository at this point in the history
  • Loading branch information
M4RC02U1F4A4 authored Apr 28, 2024
1 parent 337fc72 commit a18adc3
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,22 @@ on:
- '*'

jobs:
check-tag:
runs-on: ubuntu-latest
steps:
- name: Check tag format
run: |
if [[ ${{ github.ref_name }} =~ ^refs\/tags\/(?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
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/web-backend-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,31 @@ jobs:
if-no-files-found: error
retention-days: 1

tag:
needs: build
runs-on: ubuntu-latest
outputs:
release: ${{ steps.determine_tag.outputs.release }}
steps:
- name: Find tag
id: determine_tag
run: |
if [[ ${{ github.event.release.tag_name }} == *"beta"* ]]; then
echo "release=beta" >> "$GITHUB_OUTPUT"
elif [[ ${{ github.event.release.tag_name }} == *"alpha"* ]]; then
echo "release=alpha" >> "$GITHUB_OUTPUT"
else
echo "release=latest" >> "$GITHUB_OUTPUT"
fi
push:
needs: build
needs: tag
runs-on: ubuntu-latest
strategy:
matrix:
tags:
- ${{ github.event.release.tag_name }}
- latest
- ${{ needs.tag.outputs.release }}
steps:
- name: Setup
run: |
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/web-frontend-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,31 @@ jobs:
if-no-files-found: error
retention-days: 1

tag:
needs: build
runs-on: ubuntu-latest
outputs:
release: ${{ steps.determine_tag.outputs.release }}
steps:
- name: Find tag
id: determine_tag
run: |
if [[ ${{ github.event.release.tag_name }} == *"beta"* ]]; then
echo "release=beta" >> "$GITHUB_OUTPUT"
elif [[ ${{ github.event.release.tag_name }} == *"alpha"* ]]; then
echo "release=alpha" >> "$GITHUB_OUTPUT"
else
echo "release=latest" >> "$GITHUB_OUTPUT"
fi
push:
needs: build
needs: tag
runs-on: ubuntu-latest
strategy:
matrix:
tags:
- ${{ github.event.release.tag_name }}
- latest
- ${{ needs.tag.outputs.release }}
steps:
- name: Setup
run: |
Expand Down

0 comments on commit a18adc3

Please sign in to comment.