Files
TerminalBasic/.gitea/workflows/build.yml
T

110 lines
5.1 KiB
YAML

name: Release-Build und Veröffentlichung
on:
push:
tags: ['v[0-9]*.[0-9]*.[0-9]*']
permissions:
contents: read
jobs:
preflight:
runs-on: linux-arm64
container: ghcr.io/rust-cross/cargo-zigbuild@sha256:82af75c41958c2af2787e8bedd912da7678a9438937e223e9d83d006d747b38b
timeout-minutes: 60
steps:
# Vor checkout nötig: Die Cross-Images enthalten kein Node für JS-Actions.
- name: Gepinnte Actions-Laufzeit
run: |
set -eu
curl -fsSL https://nodejs.org/dist/v22.22.0/node-v22.22.0-linux-arm64.tar.xz -o /tmp/tb-node.tar.xz
echo '1bf1eb9ee63ffc4e5d324c0b9b62cf4a289f44332dfef9607cea1a0d9596ba6f /tmp/tb-node.tar.xz' | sha256sum -c -
tar -xJf /tmp/tb-node.tar.xz -C /usr/local --strip-components=1
node --version
- uses: https://gitea.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
persist-credentials: false
- name: Release-Tag und Workspace-Version prüfen
env:
TB_TAG: ${{ gitea.ref_name }}
PYTHONPATH: .gitea/scripts
run: |
python3 - <<'PYTHON'
import os, tomllib
import distribution as dist
from release import release_version
version = tomllib.loads((dist.ROOT / 'Cargo.toml').read_text())['workspace']['package']['version']
dist.require(release_version(os.environ['TB_TAG']) == version, 'Tag und Workspace-Version weichen ab')
PYTHON
build:
needs: preflight
runs-on: linux-arm64
timeout-minutes: 90
strategy:
fail-fast: false
max-parallel: 1
matrix:
include:
- target: x86_64-pc-windows-msvc
image: messense/cargo-xwin@sha256:4696dd4e79edf8569fa99c4b06bd99273e0501c7adc983aa61d57945f795bef0
- target: aarch64-apple-darwin
image: ghcr.io/rust-cross/cargo-zigbuild@sha256:82af75c41958c2af2787e8bedd912da7678a9438937e223e9d83d006d747b38b
- target: x86_64-unknown-linux-gnu
image: ghcr.io/rust-cross/cargo-zigbuild@sha256:82af75c41958c2af2787e8bedd912da7678a9438937e223e9d83d006d747b38b
- target: aarch64-unknown-linux-gnu
image: ghcr.io/rust-cross/cargo-zigbuild@sha256:82af75c41958c2af2787e8bedd912da7678a9438937e223e9d83d006d747b38b
container: ${{ matrix.image }}
env:
TB_BUILD_IMAGE: ${{ matrix.image }}
TB_TARGET: ${{ matrix.target }}
steps:
# Vor checkout nötig: Die Cross-Images enthalten kein Node für JS-Actions.
- name: Gepinnte Actions-Laufzeit
run: |
set -eu
curl -fsSL https://nodejs.org/dist/v22.22.0/node-v22.22.0-linux-arm64.tar.xz -o /tmp/tb-node.tar.xz
echo '1bf1eb9ee63ffc4e5d324c0b9b62cf4a289f44332dfef9607cea1a0d9596ba6f /tmp/tb-node.tar.xz' | sha256sum -c -
tar -xJf /tmp/tb-node.tar.xz -C /usr/local --strip-components=1
node --version
- uses: https://gitea.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
persist-credentials: false
- run: sh .gitea/scripts/bootstrap.sh
- name: Bauen, Format prüfen und paketieren
run: python3 .gitea/scripts/build.py --target "$TB_TARGET" --output dist
- uses: https://gitea.com/actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5
with:
name: packages-${{ matrix.target }}
path: dist/
if-no-files-found: error
release:
if: startsWith(gitea.ref, 'refs/tags/v') && gitea.event_name == 'push'
needs: [preflight, build]
runs-on: linux-arm64
container: ghcr.io/rust-cross/cargo-zigbuild@sha256:82af75c41958c2af2787e8bedd912da7678a9438937e223e9d83d006d747b38b
steps:
# Vor checkout nötig: Die Cross-Images enthalten kein Node für JS-Actions.
- name: Gepinnte Actions-Laufzeit
run: |
set -eu
curl -fsSL https://nodejs.org/dist/v22.22.0/node-v22.22.0-linux-arm64.tar.xz -o /tmp/tb-node.tar.xz
echo '1bf1eb9ee63ffc4e5d324c0b9b62cf4a289f44332dfef9607cea1a0d9596ba6f /tmp/tb-node.tar.xz' | sha256sum -c -
tar -xJf /tmp/tb-node.tar.xz -C /usr/local --strip-components=1
node --version
- uses: https://gitea.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
persist-credentials: false
- run: sh .gitea/scripts/bootstrap.sh
- uses: https://gitea.com/actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
path: artifacts
- run: cargo build --locked --release -p tb-export --bin tb-template
- name: Pakete hochladen und Release veröffentlichen
env:
GITEA_SERVER_URL: ${{ gitea.server_url }}
GITEA_REPOSITORY: ${{ gitea.repository }}
TB_RELEASE_TOKEN: ${{ secrets.TB_RELEASE_TOKEN || gitea.token }}
TB_TAG: ${{ gitea.ref_name }}
TB_REVISION: ${{ gitea.sha }}
run: |
mkdir packages
cp artifacts/packages-*/*.7z artifacts/packages-*/*.tar.gz artifacts/packages-*/*.sha256 packages/
python3 .gitea/scripts/release.py --packages packages --tag "$TB_TAG" --revision "$TB_REVISION"