Some checks failed
release / release (push) Failing after 1m24s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
80 lines
3.5 KiB
YAML
80 lines
3.5 KiB
YAML
# Follows Valve's official steam-launcher: when Valve has a version that has
|
|
# no release here yet, builds the store package and publishes release
|
|
# v<version> (tag on the current main). Every Monday, on every push to main,
|
|
# and by hand.
|
|
#
|
|
# Runner hygiene (shared host, little disk): runs in the runner image that is
|
|
# already on the host (no image pull), uses no `uses:` actions (no action
|
|
# cache), and deletes everything it made at the end.
|
|
name: release
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: "17 4 * * 1"
|
|
jobs:
|
|
release:
|
|
runs-on: build
|
|
container:
|
|
image: docker.gitea.com/runner-images:ubuntu-latest
|
|
env:
|
|
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
|
|
W: /tmp/fennec-steam
|
|
CARGO_HOME: /tmp/fennec-steam/cargo
|
|
RUSTUP_HOME: /tmp/fennec-steam/rustup
|
|
CARGO_TARGET_DIR: /tmp/fennec-steam/target
|
|
SDK_GIT: https://gitea.bluefox.support/fennec/sdk
|
|
SDK_TAG: v0.1.0
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
mkdir -p "$W"
|
|
# The Fennec SDK through cargo, with this job's token (works while
|
|
# the Gitea needs a login to read).
|
|
git config --global "http.${GITHUB_SERVER_URL}/fennec/sdk.extraHeader" "Authorization: token ${{ secrets.GITHUB_TOKEN }}"
|
|
git clone --depth 1 --branch main \
|
|
"${GITHUB_SERVER_URL%%://*}://oauth2:${{ secrets.GITHUB_TOKEN }}@${GITHUB_SERVER_URL#*://}/${GITHUB_REPOSITORY}.git" "$W/src"
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
apt-get update -qq
|
|
apt-get install -y -qq --no-install-recommends gpgv dpkg >/dev/null
|
|
rm -rf /var/lib/apt/lists/*
|
|
- name: New Valve version?
|
|
id: check
|
|
env:
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
v=$(bash "$W/src/fetch-steam.sh" --version)
|
|
code=$(curl -s -o /dev/null -w '%{http_code}' -H "Authorization: token $TOKEN" \
|
|
"$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases/tags/v$v")
|
|
echo "Valve: $v, release v$v: HTTP $code"
|
|
echo "version=$v" >> "$GITHUB_OUTPUT"
|
|
[ "$code" = 200 ] && echo "new=0" >> "$GITHUB_OUTPUT" || echo "new=1" >> "$GITHUB_OUTPUT"
|
|
- name: Build
|
|
if: steps.check.outputs.new == '1'
|
|
run: |
|
|
curl -sSf https://sh.rustup.rs | sh -s -- -y -q --profile minimal --no-modify-path
|
|
export PATH="$CARGO_HOME/bin:$PATH"
|
|
cargo install -q --locked --git "$SDK_GIT" --tag "$SDK_TAG" sf-pack
|
|
"$W/src/package.sh"
|
|
ls "$W"/src/dist | grep -q -- "-${{ steps.check.outputs.version }}.tar.zst$" || { echo "built another version" >&2; exit 1; }
|
|
- name: Release
|
|
if: steps.check.outputs.new == '1'
|
|
env:
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
V: ${{ steps.check.outputs.version }}
|
|
run: |
|
|
api="$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases"
|
|
id=$(curl -fsS -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"v$V\",\"target_commitish\":\"main\",\"name\":\"v$V\",\"body\":\"Valve steam-launcher $V\"}" "$api" \
|
|
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
|
for f in "$W"/src/dist/*; do
|
|
curl -fsS -H "Authorization: token $TOKEN" -F "attachment=@$f" "$api/$id/assets?name=$(basename "$f")" >/dev/null
|
|
done
|
|
echo "released v$V"
|
|
- name: Clean up
|
|
if: always()
|
|
run: |
|
|
rm -rf "$W"
|
|
df -h / | tail -1
|