Skip to content

Commit 329ed10

Browse files
committed
.github: experimental workflow
Signed-off-by: Joachim Wiberg <[email protected]>
1 parent fdb9373 commit 329ed10

File tree

1 file changed

+139
-0
lines changed

1 file changed

+139
-0
lines changed

.github/workflows/build.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build-appimage:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
arch: [x86_64, aarch64]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up QEMU
23+
if: matrix.arch == 'aarch64'
24+
uses: docker/setup-qemu-action@v3
25+
with:
26+
platforms: arm64
27+
28+
- name: Build AppImage (${{ matrix.arch }})
29+
run: |
30+
if [ "${{ matrix.arch }}" = "aarch64" ]; then
31+
docker run --rm --platform linux/arm64 \
32+
-v $PWD:/workspace -w /workspace \
33+
--entrypoint /bin/bash \
34+
ubuntu:22.04 -c '
35+
apt-get update && \
36+
apt-get install -y wget file libsdl2-dev libsdl2-ttf-dev \
37+
libsdl2-image-dev libsdl2-mixer-dev build-essential && \
38+
make clean && make && make appimage
39+
'
40+
else
41+
sudo apt-get update
42+
sudo apt-get install -y libsdl2-dev libsdl2-ttf-dev \
43+
libsdl2-image-dev libsdl2-mixer-dev
44+
make clean && make && make appimage
45+
fi
46+
47+
- name: Rename AppImage
48+
run: |
49+
mv InfixDemo-x86_64.AppImage InfixDemo-${{ matrix.arch }}.AppImage || true
50+
51+
- name: Upload AppImage artifact
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: appimage-${{ matrix.arch }}
55+
path: InfixDemo-${{ matrix.arch }}.AppImage
56+
57+
build-docker:
58+
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read
61+
packages: write
62+
strategy:
63+
matrix:
64+
platform: [linux/amd64, linux/arm64]
65+
66+
steps:
67+
- uses: actions/checkout@v4
68+
69+
- name: Set up QEMU
70+
uses: docker/setup-qemu-action@v3
71+
72+
- name: Set up Docker Buildx
73+
uses: docker/setup-buildx-action@v3
74+
75+
- name: Log in to Container Registry
76+
uses: docker/login-action@v3
77+
with:
78+
registry: ${{ env.REGISTRY }}
79+
username: ${{ github.actor }}
80+
password: ${{ secrets.GITHUB_TOKEN }}
81+
82+
- name: Extract metadata
83+
id: meta
84+
uses: docker/metadata-action@v5
85+
with:
86+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
87+
tags: |
88+
type=raw,value=latest
89+
type=sha,prefix={{branch}}-
90+
91+
- name: Build and push Docker image
92+
uses: docker/build-push-action@v5
93+
with:
94+
context: .
95+
platforms: ${{ matrix.platform }}
96+
push: true
97+
tags: ${{ steps.meta.outputs.tags }}
98+
labels: ${{ steps.meta.outputs.labels }}
99+
cache-from: type=gha
100+
cache-to: type=gha,mode=max
101+
102+
release:
103+
needs: [build-appimage]
104+
runs-on: ubuntu-latest
105+
permissions:
106+
contents: write
107+
108+
steps:
109+
- uses: actions/checkout@v4
110+
111+
- name: Download all artifacts
112+
uses: actions/download-artifact@v4
113+
with:
114+
path: artifacts
115+
116+
- name: Display structure of downloaded files
117+
run: ls -R artifacts
118+
119+
- name: Create/Update Release
120+
uses: ncipollo/release-action@v1
121+
with:
122+
tag: latest
123+
name: Latest Build
124+
body: |
125+
Automated build of Infix Demo
126+
127+
**AppImages:**
128+
- `InfixDemo-x86_64.AppImage` - x86_64 build
129+
- `InfixDemo-aarch64.AppImage` - ARM64 build
130+
131+
**Docker images:**
132+
- `ghcr.io/${{ github.repository }}:latest`
133+
134+
Built from commit: ${{ github.sha }}
135+
artifacts: "artifacts/**/*.AppImage"
136+
allowUpdates: true
137+
removeArtifacts: true
138+
makeLatest: true
139+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)