Skip to content

Commit

Permalink
Expand trunk builds for tags
Browse files Browse the repository at this point in the history
Signed-off-by: Vasyl Gello <[email protected]>
  • Loading branch information
basilgello committed Aug 5, 2024
1 parent 5a87e43 commit 9395ddb
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/trunk.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: Trunk build
name: Trunk / release build

on:
push:
branch: develop
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-[0-9]+'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -24,6 +29,19 @@ jobs:
with:
fetch-depth: 0

- name: Check if commit needs a release upload
run: |
if [ "${{ github.ref_type }}" = "tag" ]; then
echo "PRERELEASE=''" >> "$GITHUB_ENV"
echo "RELEASE_NAME='${{ github.ref_name }}'" >> "$GITHUB_ENV"
elif "${{ github.ref }}" = "refs/heads/develop" ]; then
echo "PRERELEASE=--prerelease" >> "$GITHUB_ENV"
echo "RELEASENAME=trunk" >> "$GITHUB_ENV"
else
echo "Not a tag or develop branch, skipping upload"
echo "SKIP_UPLOAD=1" >> "$GITHUB_ENV"
fi
- name: Build yggstack executables
run: |
set -e
Expand Down Expand Up @@ -210,26 +228,30 @@ jobs:
#echo "::endgroup::"
- name: Publish release
if: ${{ env.SKIP_UPLOAD != '1' }}
run: |
gh release create trunk --prerelease yggstack-* || gh release upload trunk yggstack-* --clobber
gh release create "${{ env.RELEASENAME }}" "${{ env.PRERELEASE }}" yggstack-* || gh release upload "${{ env.RELEASENAME }}" yggstack-* --clobber
env:
GH_TOKEN: ${{ github.token }}

- name: Set up Docker Buildx
if: ${{ env.SKIP_UPLOAD != '1' }}
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
if: ${{ env.SKIP_UPLOAD != '1' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push yggstack container image
if: ${{ env.SKIP_UPLOAD != '1' }}
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.static
platforms: linux/386, linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64, linux/ppc64le, linux/riscv64, linux/s390x
push: true
tags: ghcr.io/yggdrasil-network/yggstack:trunk
tags: ghcr.io/yggdrasil-network/yggstack:${{ env.RELEASENAME }}

0 comments on commit 9395ddb

Please sign in to comment.