# 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 (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: 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" 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' env: V: ${{ steps.check.outputs.version }} 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" [ -f "$W/src/dist/support.bluefox.steam-$V.tar.zst" ] || { echo "built another version than $V" >&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