Skip to content

fix: build the binary from the test script #1

fix: build the binary from the test script

fix: build the binary from the test script #1

Workflow file for this run

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.