@@ -30,38 +30,11 @@ jobs:
30
30
release-web :
31
31
runs-on : ubuntu-latest
32
32
steps :
33
- - name : Checkout Code
33
+ - name : Checkout code
34
34
uses : actions/checkout@v4
35
35
with :
36
- # For manual runs, allow building a chosen ref (branch/tag/SHA)
37
36
ref : ${{ inputs.ref != '' && inputs.ref || github.ref }}
38
37
39
- - name : Determine tag & latest flag
40
- id : meta
41
- shell : bash
42
- run : |
43
- # Determine TAG
44
- if [ "${{ github.event_name }}" = "release" ]; then
45
- TAG="${{ github.event.release.tag_name }}"
46
- # Push "latest" only for full releases (not prereleases)
47
- if [ "${{ github.event.release.prerelease }}" = "true" ]; then
48
- PUSH_LATEST="false"
49
- else
50
- PUSH_LATEST="true"
51
- fi
52
- elif [ -n "${{ inputs.tag_name }}" ]; then
53
- TAG="${{ inputs.tag_name }}"
54
- PUSH_LATEST="false"
55
- else
56
- SHA="$(git rev-parse --short=12 HEAD)"
57
- TAG="adhoc-${SHA}"
58
- PUSH_LATEST="false"
59
- fi
60
-
61
- echo "tag=$TAG" >> "$GITHUB_OUTPUT"
62
- echo "push_latest=$PUSH_LATEST" >> "$GITHUB_OUTPUT"
63
- echo "Resolved tag: $TAG (push_latest=$PUSH_LATEST)"
64
-
65
38
- name : Setup pnpm
66
39
uses : pnpm/action-setup@v4
67
40
with :
@@ -81,63 +54,62 @@ jobs:
81
54
working-directory : packages/web
82
55
run : pnpm run build
83
56
84
- - name : Create Web App Release Archive
57
+ - name : Create release archive
85
58
working-directory : packages/web
86
59
run : pnpm run package
87
60
88
- - name : Upload Web App Archive (artifact)
61
+ - name : Upload archive (artifact)
89
62
uses : actions/upload-artifact@v4
90
63
with :
91
- name : web-build-${{ steps.meta.outputs.tag }}
92
- if-no-files-found : error
64
+ name : web-build
93
65
path : packages/web/dist/build.tar
66
+ if-no-files-found : error
94
67
95
- - name : Attach Web Archive to GitHub Release
68
+ - name : Attach archive to GitHub Release
96
69
if : ${{ github.event_name == 'release' || inputs.attach_to_release == true }}
70
+ uses : softprops/action-gh-release@v2
71
+ with :
72
+ files : packages/web/dist/build.tar
73
+ tag_name : ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag_name }}
74
+ fail_on_unmatched_files : true
97
75
env :
98
76
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
99
- shell : bash
100
- run : |
101
- if [ "${{ github.event_name }}" = "release" ]; then
102
- TAG="${{ steps.meta.outputs.tag }}"
103
- else
104
- if [ -z "${{ inputs.tag_name }}" ]; then
105
- echo "attach_to_release requested but no tag_name provided." >&2
106
- exit 1
107
- fi
108
- TAG="${{ inputs.tag_name }}"
109
- fi
110
- gh release upload "$TAG" packages/web/dist/build.tar --clobber
77
+
78
+ - name : Docker metadata (tags & labels)
79
+ id : meta
80
+ uses : docker/metadata-action@v5
81
+ with :
82
+ images : ${{ env.REGISTRY_IMAGE }}
83
+ tags : |
84
+ # For release events, use the release tag (e.g. v1.2.3)
85
+ type=raw,value=${{ github.event.release.tag_name }},enable=${{ github.event_name == 'release' }}
86
+ # For manual runs with a provided tag_name
87
+ type=raw,value=${{ inputs.tag_name }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.tag_name != '' }}
88
+ # For manual runs without tag_name, fall back to adhoc-<shortsha>
89
+ type=sha,format=short,prefix=adhoc-,enable=${{ github.event_name == 'workflow_dispatch' && inputs.tag_name == '' }}
90
+ # Add "latest" only for full releases (not prereleases)
91
+ type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.release.prerelease == false }}
111
92
112
93
- name : Set up QEMU
113
94
uses : docker/setup-qemu-action@v3
114
95
115
- - name : Build Container Image
116
- id : build-container
117
- uses : redhat-actions/buildah-build@v2
118
- with :
119
- containerfiles : |
120
- ./packages/web/infra/Containerfile
121
- image : ${{ env.REGISTRY_IMAGE }}
122
- tags : latest,${{ steps.meta.outputs.tag }}
123
- oci : true
124
- platforms : linux/amd64,linux/arm64
96
+ - name : Set up Buildx
97
+ uses : docker/setup-buildx-action@v3
125
98
126
- - name : Push Container to GHCR
127
- id : push-to-registry
128
- if : ${{ github.event_name == 'release' && github.event.release.prerelease == false }}
129
- uses : redhat-actions/push-to-registry@v2
99
+ - name : Build and (maybe) push image
100
+ uses : docker/build-push-action@v6
130
101
with :
131
- image : ${{ steps.build-container.outputs.image }}
132
- tags : ${{ steps.build-container.outputs.tags }}
133
- registry : ghcr.io
134
- username : ${{ github.actor }}
135
- password : ${{ secrets.GITHUB_TOKEN }}
102
+ context : .
103
+ file : ./packages/web/infra/Containerfile
104
+ platforms : linux/amd64,linux/arm64
105
+ push : ${{ github.event_name == 'release' && github.event.release.prerelease == false }}
106
+ tags : ${{ steps.meta.outputs.tags }}
107
+ labels : ${{ steps.meta.outputs.labels }}
136
108
137
- - name : Output Image URL
109
+ - name : Output image refs
138
110
if : ${{ github.event_name == 'release' && github.event.release.prerelease == false }}
139
- run : echo "🖼️ Image pushed to ${{ steps.push-to-registry .outputs.registry-paths }}"
111
+ run : " echo \ " 🖼️ Pushed: ${{ steps.meta .outputs.tags }}\" "
140
112
141
- - name : Explain no image URL
113
+ - name : Explain no image push
142
114
if : ${{ !(github.event_name == 'release' && github.event.release.prerelease == false) }}
143
- run : echo "ℹ️ No image pushed (this was a prerelease or manual run)."
115
+ run : echo "ℹ️ No image pushed (prerelease or manual run)."
0 commit comments