Expand trunk builds for tags

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
This commit is contained in:
Vasyl Gello 2024-08-05 21:52:10 +03:00
parent 5a87e43f9a
commit 9395ddbfa2

View file

@ -1,8 +1,13 @@
name: Trunk build name: Trunk / release build
on: on:
push: push:
branch: develop 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: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
@ -24,6 +29,19 @@ jobs:
with: with:
fetch-depth: 0 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 - name: Build yggstack executables
run: | run: |
set -e set -e
@ -210,15 +228,18 @@ jobs:
#echo "::endgroup::" #echo "::endgroup::"
- name: Publish release - name: Publish release
if: ${{ env.SKIP_UPLOAD != '1' }}
run: | 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: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
- name: Set up Docker Buildx - name: Set up Docker Buildx
if: ${{ env.SKIP_UPLOAD != '1' }}
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
if: ${{ env.SKIP_UPLOAD != '1' }}
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
@ -226,10 +247,11 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push yggstack container image - name: Build and push yggstack container image
if: ${{ env.SKIP_UPLOAD != '1' }}
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
file: Dockerfile.static file: Dockerfile.static
platforms: linux/386, linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64, linux/ppc64le, linux/riscv64, linux/s390x platforms: linux/386, linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64, linux/ppc64le, linux/riscv64, linux/s390x
push: true push: true
tags: ghcr.io/yggdrasil-network/yggstack:trunk tags: ghcr.io/yggdrasil-network/yggstack:${{ env.RELEASENAME }}