docs: stamp the v0.3.0 changelog #12
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release | |
| on: | |
| push: | |
| tags: ['v*'] | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| # Build the shims against an OLD glibc (debian 11, 2.31). A .so built | |
| # on the runner's modern glibc records symbol versions that do not | |
| # exist on older distros, and refuses to load there. Building old | |
| # keeps one binary working from glibc 2.6 upward. | |
| - name: build shims on old glibc | |
| run: | | |
| mkdir -p build | |
| docker run --rm -v "$PWD:/w" -w /w debian:11 bash -c ' | |
| apt-get update -qq && apt-get install -y -qq gcc gcc-aarch64-linux-gnu binutils | |
| gcc -shared -fPIC -O2 -Wall -o build/libundo_amd64.so shim/undo_shim.c -ldl -lpthread | |
| aarch64-linux-gnu-gcc -shared -fPIC -O2 -Wall -o build/libundo_arm64.so shim/undo_shim.c -ldl -lpthread | |
| ' | |
| - name: assert the shims load on old distros | |
| run: | | |
| for f in build/libundo_amd64.so build/libundo_arm64.so; do | |
| max=$(objdump -T "$f" | grep -o 'GLIBC_[0-9.]*' | sort -u -V | tail -1) | |
| echo "$f requires up to $max" | |
| case "$max" in | |
| GLIBC_2.[0-9]|GLIBC_2.[12][0-9]) ;; | |
| *) echo "::error::$f needs $max, too new for common distros"; exit 1 ;; | |
| esac | |
| done | |
| - uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| version: '~> v2' | |
| args: release --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # PAT with push access to edaywalid/homebrew-tap; formula upload | |
| # fails gracefully absent while the release itself still publishes | |
| TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }} | |
| # goreleaser's own aurs: block builds and pushes undo-cli-bin | |
| AUR_KEY: ${{ secrets.AUR_KEY }} | |
| # goreleaser covers the -bin package but cannot also do the source one | |
| # (aurs + aur_sources panics), so undo-cli is rendered from the tag | |
| # that was just released and pushed here. | |
| - name: publish the source package to the AUR | |
| env: | |
| AUR_KEY: ${{ secrets.AUR_KEY }} | |
| run: | | |
| # opt-in: skip cleanly until the deploy key is configured, so the | |
| # release never depends on it | |
| if [ -z "${AUR_KEY:-}" ]; then | |
| echo "AUR_KEY not set, skipping the source package" | |
| exit 0 | |
| fi | |
| # render.sh needs makepkg to write .SRCINFO, which exists only on | |
| # Arch and refuses to run as root. The `pacman || true` that used | |
| # to stand here silently did nothing on ubuntu, so .SRCINFO was | |
| # never regenerated and the AUR kept serving an older pkgver than | |
| # the PKGBUILD beside it. | |
| docker run --rm -e TAG="${GITHUB_REF_NAME}" -v "$PWD:/w" -w /w \ | |
| archlinux:base-devel bash -c ' | |
| set -e | |
| command -v curl >/dev/null || pacman -Sy --noconfirm --needed curl | |
| useradd -m builder | |
| chown -R builder /w | |
| su builder -c "packaging/aur/render.sh $TAG" | |
| ' | |
| sudo chown -R "$(id -u):$(id -g)" packaging/aur | |
| mkdir -p ~/.ssh && chmod 700 ~/.ssh | |
| printf '%s\n' "$AUR_KEY" > ~/.ssh/aur && chmod 600 ~/.ssh/aur | |
| cat >> ~/.ssh/config <<'EOF' | |
| Host aur.archlinux.org | |
| User aur | |
| IdentityFile ~/.ssh/aur | |
| IdentitiesOnly yes | |
| StrictHostKeyChecking accept-new | |
| EOF | |
| git config --global user.name edaywalid | |
| git config --global user.email becharwalid9@gmail.com | |
| git clone ssh://aur@aur.archlinux.org/undo-cli.git /tmp/undo-cli | |
| # both, always: shipping one without the other is the drift above | |
| cp packaging/aur/undo-cli/PKGBUILD packaging/aur/undo-cli/.SRCINFO \ | |
| /tmp/undo-cli/ | |
| git -C /tmp/undo-cli add -A | |
| if git -C /tmp/undo-cli diff --cached --quiet; then | |
| echo "undo-cli unchanged" | |
| else | |
| git -C /tmp/undo-cli commit -m "undo-cli ${GITHUB_REF_NAME#v}" | |
| git -C /tmp/undo-cli push origin master | |
| fi |