Build tagged releases on Gitea (#79)
Some checks failed
Tagged release / prepare-release (push) Successful in 4s
Tagged release / build-unix (aarch64-apple-darwin, darwin-arm64, aarch64-apple-darwin) (push) Failing after 54s
Tagged release / build-unix (aarch64-unknown-linux-gnu.2.28, linux-arm64, aarch64-unknown-linux-gnu) (push) Failing after 0s
Tagged release / build-unix (x86_64-unknown-linux-gnu.2.28, linux-x64, x86_64-unknown-linux-gnu) (push) Failing after 1s
Tagged release / build-windows (push) Failing after 35s
Tagged release / publish-release (push) Has been skipped
Some checks failed
Tagged release / prepare-release (push) Successful in 4s
Tagged release / build-unix (aarch64-apple-darwin, darwin-arm64, aarch64-apple-darwin) (push) Failing after 54s
Tagged release / build-unix (aarch64-unknown-linux-gnu.2.28, linux-arm64, aarch64-unknown-linux-gnu) (push) Failing after 0s
Tagged release / build-unix (x86_64-unknown-linux-gnu.2.28, linux-x64, x86_64-unknown-linux-gnu) (push) Failing after 1s
Tagged release / build-windows (push) Failing after 35s
Tagged release / publish-release (push) Has been skipped
This commit is contained in:
171
.gitea/workflows/release.yml
Normal file
171
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,171 @@
|
||||
name: Tagged release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
prepare-release:
|
||||
runs-on: linux-arm64
|
||||
outputs:
|
||||
release_id: ${{ steps.release.outputs.release_id }}
|
||||
steps:
|
||||
- name: Check out the tag
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Test release-note generation
|
||||
run: python3 .gitea/scripts/release.py test
|
||||
|
||||
- name: Create draft release
|
||||
id: release
|
||||
env:
|
||||
GITEA_API_URL: ${{ gitea.server_url }}/api/v1
|
||||
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||
GITEA_REF_NAME: ${{ gitea.ref_name }}
|
||||
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
||||
GITEA_SHA: ${{ gitea.sha }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: python3 .gitea/scripts/release.py prepare
|
||||
|
||||
build-unix:
|
||||
needs: prepare-release
|
||||
runs-on: linux-arm64
|
||||
container: ghcr.io/rust-cross/cargo-zigbuild@sha256:8797479160b221b4ead24b242279af86684771a3c20944b0d7004dfe946275bc
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: aarch64-unknown-linux-gnu
|
||||
build-target: aarch64-unknown-linux-gnu.2.28
|
||||
platform: linux-arm64
|
||||
- target: x86_64-unknown-linux-gnu
|
||||
build-target: x86_64-unknown-linux-gnu.2.28
|
||||
platform: linux-x64
|
||||
- target: aarch64-apple-darwin
|
||||
build-target: aarch64-apple-darwin
|
||||
platform: darwin-arm64
|
||||
steps:
|
||||
- name: Check out the tag
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cross-build release binaries
|
||||
run: >-
|
||||
cargo zigbuild --release --locked
|
||||
--target ${{ matrix.build-target }}
|
||||
--package ironstorage-cli
|
||||
--package ironstorage-tui
|
||||
--package ironstorage-desktop
|
||||
|
||||
- name: Package CLI, TUI, and desktop application
|
||||
env:
|
||||
PLATFORM: ${{ matrix.platform }}
|
||||
TAG: ${{ gitea.ref_name }}
|
||||
TARGET: ${{ matrix.target }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
version=$(printf '%s' "$TAG" | sed 's/[^A-Za-z0-9._-]/-/g')
|
||||
cli="ironstorage-cli-${version}-${PLATFORM}"
|
||||
desktop="ironstorage-desktop-${version}-${PLATFORM}"
|
||||
mkdir -p "dist/$cli" "dist/$desktop"
|
||||
cp "target/$TARGET/release/ironstorage" "dist/$cli/"
|
||||
cp "target/$TARGET/release/ironstorage-tui" "dist/$cli/"
|
||||
cp "target/$TARGET/release/ironstorage" "dist/$desktop/"
|
||||
cp "target/$TARGET/release/ironstorage-tui" "dist/$desktop/"
|
||||
cp "target/$TARGET/release/ironstorage-desktop" "dist/$desktop/"
|
||||
tar -C dist -czf "dist/${cli}.tar.gz" "$cli"
|
||||
tar -C dist -czf "dist/${desktop}.tar.gz" "$desktop"
|
||||
rm -r "dist/$cli" "dist/$desktop"
|
||||
|
||||
- name: Upload release packages
|
||||
env:
|
||||
GITEA_API_URL: ${{ gitea.server_url }}/api/v1
|
||||
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
RELEASE_ID: ${{ needs.prepare-release.outputs.release_id }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
for asset in dist/*.tar.gz; do
|
||||
name=$(basename "$asset")
|
||||
curl --fail --silent --show-error --retry 3 \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@$asset" \
|
||||
"$GITEA_API_URL/repos/$GITEA_REPOSITORY/releases/$RELEASE_ID/assets?name=$name"
|
||||
done
|
||||
|
||||
build-windows:
|
||||
needs: prepare-release
|
||||
runs-on: linux-arm64
|
||||
container: messense/cargo-xwin@sha256:4696dd4e79edf8569fa99c4b06bd99273e0501c7adc983aa61d57945f795bef0
|
||||
steps:
|
||||
- name: Check out the tag
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install the repository Rust toolchain
|
||||
run: rustup toolchain install 1.92.0 --profile minimal --target x86_64-pc-windows-msvc
|
||||
|
||||
- name: Cross-build release binaries
|
||||
run: >-
|
||||
cargo +1.92.0 xwin build --release --locked
|
||||
--target x86_64-pc-windows-msvc
|
||||
--package ironstorage-cli
|
||||
--package ironstorage-tui
|
||||
--package ironstorage-desktop
|
||||
|
||||
- name: Package CLI, TUI, and desktop application
|
||||
env:
|
||||
TAG: ${{ gitea.ref_name }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
version=$(printf '%s' "$TAG" | sed 's/[^A-Za-z0-9._-]/-/g')
|
||||
cli="ironstorage-cli-${version}-windows-x64"
|
||||
desktop="ironstorage-desktop-${version}-windows-x64"
|
||||
release=target/x86_64-pc-windows-msvc/release
|
||||
mkdir -p "dist/$cli" "dist/$desktop"
|
||||
cp "$release/ironstorage.exe" "$release/ironstorage-tui.exe" "dist/$cli/"
|
||||
cp "$release/ironstorage.exe" "$release/ironstorage-tui.exe" \
|
||||
"$release/ironstorage-desktop.exe" "dist/$desktop/"
|
||||
tar -C dist -czf "dist/${cli}.tar.gz" "$cli"
|
||||
tar -C dist -czf "dist/${desktop}.tar.gz" "$desktop"
|
||||
rm -r "dist/$cli" "dist/$desktop"
|
||||
|
||||
- name: Upload release packages
|
||||
env:
|
||||
GITEA_API_URL: ${{ gitea.server_url }}/api/v1
|
||||
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
RELEASE_ID: ${{ needs.prepare-release.outputs.release_id }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
for asset in dist/*.tar.gz; do
|
||||
name=$(basename "$asset")
|
||||
curl --fail --silent --show-error --retry 3 \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@$asset" \
|
||||
"$GITEA_API_URL/repos/$GITEA_REPOSITORY/releases/$RELEASE_ID/assets?name=$name"
|
||||
done
|
||||
|
||||
publish-release:
|
||||
needs:
|
||||
- prepare-release
|
||||
- build-unix
|
||||
- build-windows
|
||||
runs-on: linux-arm64
|
||||
steps:
|
||||
- name: Check out the tag
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Publish complete release
|
||||
env:
|
||||
GITEA_API_URL: ${{ gitea.server_url }}/api/v1
|
||||
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
RELEASE_ID: ${{ needs.prepare-release.outputs.release_id }}
|
||||
run: python3 .gitea/scripts/release.py publish
|
||||
Reference in New Issue
Block a user