-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (76 loc) · 2.62 KB
/
Copy pathrelease.yml
File metadata and controls
88 lines (76 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: release
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
tag:
description: Tag to release
required: true
permissions:
contents: write
packages: write
env:
IMAGE: ghcr.io/${{ github.repository }}
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- uses: actions/checkout@v4
- name: Resolve the version
id: version
run: |
tag="${{ inputs.tag || github.ref_name }}"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "version=${tag#v}" >> "$GITHUB_OUTPUT"
# PHP is compiled from source inside the image, once per architecture. The arm64 half
# runs under emulation, so this job is slow by nature.
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push the image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE }}:${{ steps.version.outputs.version }}
${{ env.IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Extract the binaries
run: |
mkdir -p dist
for arch in amd64 arm64; do
image="${IMAGE}:${{ steps.version.outputs.version }}"
docker pull --platform "linux/$arch" "$image"
container=$(docker create --platform "linux/$arch" "$image")
docker cp "$container:/usr/local/bin/stoke" "dist/stoke"
docker rm "$container" > /dev/null
tar -czf "dist/stoke-${{ steps.version.outputs.version }}-linux-$arch.tar.gz" \
-C dist stoke
rm dist/stoke
done
ls -la dist
- name: Publish the release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.tag }}
generate_release_notes: true
files: dist/*.tar.gz
body: |
```sh
docker run --rm -p 8080:8080 -v "$PWD/public:/app/public" \
${{ env.IMAGE }}:${{ steps.version.outputs.version }}
```
The tarballs hold the bare binary. PHP is linked into it, but these system
libraries are not: `libxml2 libssl3 zlib1g libcurl4 libpq5 libonig5`. The image
already carries them.