Skip to content

feat: release workflow #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions .github/workflows/build.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name: Build
name: Release

on:
push:
branches:
- "**"
tags:
- "v*"
workflow_dispatch:
- "v*.*.*"
pull_request:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-client:
release-client:
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -55,20 +57,27 @@ jobs:
-o dist/wst-${{ matrix.targets.OS }}-${{ matrix.targets.ARCH }}${{ matrix.targets.EXT }} \
./client

- name: Upload Binaries
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.targets.OS }}-${{ matrix.targets.ARCH }}
path: dist/*

- name: Release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }}
prerelease: false
append_body: false
fail_on_unmatched_files: true
name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'Dev Build' }}
tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'dev' }}
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
files: |
dist/*

build-server:
release-server:
runs-on: ubuntu-latest

steps:
Expand All @@ -81,6 +90,7 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
Expand All @@ -89,17 +99,27 @@ jobs:

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/') }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha

- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: server
push: true
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

Expand Down
Loading