83 lines
2.5 KiB
YAML
83 lines
2.5 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- arch: x86_64
|
|
target: x86_64-unknown-linux-gnu
|
|
runs-on: ubuntu-latest
|
|
- arch: aarch64
|
|
target: aarch64-unknown-linux-gnu
|
|
runs-on: aarch64
|
|
|
|
runs-on: ${{ matrix.runs-on }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install system dependencies
|
|
if: matrix.arch == 'x86_64'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libwayland-dev pkg-config
|
|
|
|
- name: Install Rust stable
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Cache cargo registry
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cargo/registry
|
|
key: ${{ runner.os }}-${{ matrix.arch }}-cargo-${{ hashFiles('Cargo.lock') }}
|
|
|
|
- name: Build
|
|
run: cargo build --release --target ${{ matrix.target }}
|
|
|
|
- name: Package
|
|
run: |
|
|
TAG=${{ gitea.ref_name }}
|
|
TARBALL="gpupaper-${TAG}-${{ matrix.arch }}.tar.gz"
|
|
mkdir pkg
|
|
cp target/${{ matrix.target }}/release/gpupaper pkg/
|
|
cp -r shaders pkg/
|
|
cp LICENSE pkg/
|
|
tar -czf "${TARBALL}" -C pkg .
|
|
sha256sum "${TARBALL}" > "${TARBALL}.sha256"
|
|
echo "TARBALL=${TARBALL}" >> $GITHUB_ENV
|
|
|
|
- name: Create release
|
|
run: |
|
|
curl -sX POST \
|
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
-H "Content-Type: application/json" \
|
|
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" \
|
|
-d "{\"tag_name\":\"${{ gitea.ref_name }}\",\"name\":\"${{ gitea.ref_name }}\"}" \
|
|
--fail-with-body || true
|
|
|
|
- name: Upload assets
|
|
run: |
|
|
RELEASE_ID=$(curl -s \
|
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/tags/${{ gitea.ref_name }}" \
|
|
| jq -r '.id')
|
|
|
|
for FILE in "${{ env.TARBALL }}" "${{ env.TARBALL }}.sha256"; do
|
|
curl -sX POST \
|
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=${FILE}" \
|
|
--data-binary "@${FILE}" --fail-with-body
|
|
done
|