Skip to content

Commit 2316aa5

Browse files
authored
feat: release workflow (#5)
* feat: release workflow * fix: release * fix: latest tag * fix: release tag
1 parent 4b76d4e commit 2316aa5

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

.github/workflows/build.yml renamed to .github/workflows/release.yml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
name: Build
1+
name: Release
22

33
on:
44
push:
5+
branches:
6+
- "**"
57
tags:
6-
- "v*"
7-
workflow_dispatch:
8+
- "v*.*.*"
9+
pull_request:
810

911
env:
1012
REGISTRY: ghcr.io
1113
IMAGE_NAME: ${{ github.repository }}
1214

1315
jobs:
14-
build-client:
16+
release-client:
1517
runs-on: ubuntu-latest
1618
strategy:
1719
matrix:
@@ -55,20 +57,27 @@ jobs:
5557
-o dist/wst-${{ matrix.targets.OS }}-${{ matrix.targets.ARCH }}${{ matrix.targets.EXT }} \
5658
./client
5759
60+
- name: Upload Binaries
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: ${{ matrix.targets.OS }}-${{ matrix.targets.ARCH }}
64+
path: dist/*
65+
5866
- name: Release
67+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
5968
uses: softprops/action-gh-release@v2
6069
with:
6170
token: ${{ secrets.GITHUB_TOKEN }}
6271
draft: false
63-
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }}
72+
prerelease: false
6473
append_body: false
6574
fail_on_unmatched_files: true
66-
name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'Dev Build' }}
67-
tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'dev' }}
75+
name: ${{ github.ref_name }}
76+
tag_name: ${{ github.ref_name }}
6877
files: |
6978
dist/*
7079
71-
build-server:
80+
release-server:
7281
runs-on: ubuntu-latest
7382

7483
steps:
@@ -81,6 +90,7 @@ jobs:
8190
uses: docker/setup-buildx-action@v3
8291

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

90100
- name: Extract metadata (tags, labels) for Docker
91101
id: meta
92-
uses: docker/metadata-action@v3
102+
uses: docker/metadata-action@v5
93103
with:
94104
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
105+
flavor: |
106+
latest=${{ startsWith(github.ref, 'refs/tags/') }}
107+
tags: |
108+
type=ref,event=branch
109+
type=ref,event=pr
110+
type=ref,event=tag
111+
type=semver,pattern={{version}}
112+
type=semver,pattern={{major}}.{{minor}}
113+
type=semver,pattern={{major}}
114+
type=sha
95115
96116
- name: Build and push
97117
id: docker_build
98-
uses: docker/build-push-action@v5
118+
uses: docker/build-push-action@v6
99119
with:
100120
context: server
101-
push: true
102121
platforms: linux/amd64,linux/arm64
122+
push: ${{ github.event_name != 'pull_request' }}
103123
tags: ${{ steps.meta.outputs.tags }}
104124
labels: ${{ steps.meta.outputs.labels }}
105125

0 commit comments

Comments
 (0)