Skip to content

store: add yoinks video downloader to the catalog #31

store: add yoinks video downloader to the catalog

store: add yoinks video downloader to the catalog #31

Workflow file for this run

name: Release
# Builds standalone tuiui binaries and attaches them to the GitHub Release, so
# users can install with the curl | sh installer without a Rust toolchain.
#
# Three ways to cut a release, all converging on the same build+publish job:
# * push a tag v* — the classic manual tag.
# * merge a Cargo.toml bump — a push to main whose version is new auto-tags
# and releases. No tag push needed, so an agent
# that can only open/merge PRs can still ship.
# * workflow_dispatch — type a tag by hand from the Actions tab.
on:
push:
tags: ["v*"]
branches: ["main"]
workflow_dispatch:
inputs:
tag:
description: "Release tag to create (e.g. v0.2.0)"
required: true
permissions:
contents: write
jobs:
# Decide whether this event should cut a release, and under which tag. A push
# to main releases only when Cargo.toml's version changed to a tag that does
# not yet exist — so ordinary merges are free and a version bump is the single
# release trigger. Tag pushes and manual dispatches always release.
decide:
runs-on: ubuntu-latest
outputs:
release: ${{ steps.d.outputs.release }}
tag: ${{ steps.d.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
fetch-tags: true
- id: d
run: |
ver="$(grep -m1 '^version' Cargo.toml | sed -E 's/.*"(.*)".*/\1/')"
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "tag=${{ github.event.inputs.tag }}" >>"$GITHUB_OUTPUT"
echo "release=true" >>"$GITHUB_OUTPUT"
elif [ "${{ startsWith(github.ref, 'refs/tags/') }}" = "true" ]; then
echo "tag=${{ github.ref_name }}" >>"$GITHUB_OUTPUT"
echo "release=true" >>"$GITHUB_OUTPUT"
else
# push to main: release only when the version is new.
tag="v$ver"
prev="$(git show HEAD~1:Cargo.toml 2>/dev/null | grep -m1 '^version' | sed -E 's/.*"(.*)".*/\1/' || true)"
if git rev-parse -q --verify "refs/tags/$tag" >/dev/null; then
echo "release=false" >>"$GITHUB_OUTPUT"
echo "Tag $tag already exists — nothing to release."
elif [ "$ver" = "$prev" ]; then
echo "release=false" >>"$GITHUB_OUTPUT"
echo "Version unchanged ($ver) — nothing to release."
else
echo "tag=$tag" >>"$GITHUB_OUTPUT"
echo "release=true" >>"$GITHUB_OUTPUT"
echo "New version $ver — will cut $tag."
fi
fi
# Pre-create the tag + release ONCE, before the build matrix fans out.
# Without this, the four platform jobs race to create the release via
# action-gh-release; the v0.2.11 run left the loser holding an orphaned
# draft release with its binary while the real release shipped 3 of 4
# assets. With the release existing up front, builders only ever attach.
- name: Create release up front
if: steps.d.outputs.release == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
tag="${{ steps.d.outputs.tag }}"
gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1 || \
gh release create "$tag" --repo "$GITHUB_REPOSITORY" \
--target "$GITHUB_SHA" --title "$tag" \
--notes "See CHANGELOG.md for the full release notes."
build:
needs: decide
if: needs.decide.outputs.release == 'true'
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Both macOS targets build on the Apple-Silicon runner: it has the
# x86_64 SDK, so it cross-compiles the Intel binary without depending
# on the heavily-backlogged macos-13 (Intel) runner.
- { os: macos-14, target: aarch64-apple-darwin }
- { os: macos-14, target: x86_64-apple-darwin }
# Linux builds run on 22.04 ON PURPOSE: its glibc 2.35 keeps the
# binaries runnable on Debian 12 (glibc 2.36) and Ubuntu 22.04+ —
# ubuntu-latest (24.04, glibc 2.39) produced binaries that died on
# Debian with "GLIBC_2.39 not found".
- { os: ubuntu-22.04, target: x86_64-unknown-linux-gnu }
- { os: ubuntu-22.04-arm, target: aarch64-unknown-linux-gnu }
steps:
- uses: actions/checkout@v4
# Guard against the release-engineering bug that once shipped 0.2.3
# binaries under a v0.2.4 tag (the tag was cut on the pre-bump commit):
# the prebuilt binary reported an older version than the tag, so the
# in-app updater saw a perpetual "update available" and looped forever.
# Fail the build when the tag and the source version disagree, rather
# than publishing binaries that can never satisfy the version check.
- name: Verify tag matches Cargo.toml version
run: |
want="${{ needs.decide.outputs.tag }}"; want="${want#v}"
have="$(grep -m1 '^version' Cargo.toml | sed -E 's/.*"(.*)".*/\1/')"
echo "release tag: $want | Cargo.toml: $have"
if [ "$want" != "$have" ]; then
echo "::error::Release tag v$want does not match Cargo.toml version $have — bump Cargo.toml or re-tag the right commit."
exit 1
fi
- name: Add Rust target
run: rustup target add ${{ matrix.target }}
- name: Build
run: cargo build --release --locked --target ${{ matrix.target }}
- name: Package
run: tar -C target/${{ matrix.target }}/release -czf tuiui-${{ matrix.target }}.tar.gz tuiui
- name: Attach to release
uses: softprops/action-gh-release@v2
with:
# Creates the tag (at this run's commit) and the release if missing,
# else attaches to the existing tag's release.
tag_name: ${{ needs.decide.outputs.tag }}
body: "See CHANGELOG.md for the full release notes."
files: tuiui-${{ matrix.target }}.tar.gz