lune/.github/workflows/release.yaml

123 lines
3.3 KiB
YAML
Raw Normal View History

2023-01-19 01:47:14 +00:00
name: Release
on:
workflow_dispatch:
permissions:
contents: write
defaults:
run:
shell: bash
2023-01-19 01:47:14 +00:00
jobs:
init:
name: Init
2023-01-19 01:47:14 +00:00
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.value }}
2023-01-19 01:47:14 +00:00
steps:
- name: Checkout repository
uses: actions/checkout@v4
2023-01-19 01:47:14 +00:00
- name: Get version from manifest
uses: SebRollen/toml-action@9062fbef52816d61278d24ce53c8070440e1e8dd
2023-01-19 01:47:14 +00:00
id: get_version
with:
file: Cargo.toml
2023-07-22 16:18:58 +01:00
field: package.version
2023-01-19 01:47:14 +00:00
build:
needs: ["init"]
2023-01-19 01:47:14 +00:00
strategy:
fail-fast: false
2023-01-19 01:47:14 +00:00
matrix:
include:
- name: Windows x86_64
runner-os: windows-latest
artifact-name: lune-${{ needs.init.outputs.version }}-windows-x86_64
2023-01-19 01:47:14 +00:00
cargo-target: x86_64-pc-windows-msvc
2023-05-06 08:01:46 +01:00
2023-01-19 01:47:14 +00:00
- name: Linux x86_64
runner-os: ubuntu-latest
artifact-name: lune-${{ needs.init.outputs.version }}-linux-x86_64
2023-01-19 01:47:14 +00:00
cargo-target: x86_64-unknown-linux-gnu
2023-05-06 08:01:46 +01:00
- name: Linux aarch64
runner-os: ubuntu-latest
artifact-name: lune-${{ needs.init.outputs.version }}-linux-aarch64
2023-05-06 08:01:46 +01:00
cargo-target: aarch64-unknown-linux-gnu
2023-01-19 01:47:14 +00:00
- name: macOS x86_64
runner-os: macos-latest
artifact-name: lune-${{ needs.init.outputs.version }}-macos-x86_64
2023-01-19 01:47:14 +00:00
cargo-target: x86_64-apple-darwin
2023-05-06 08:01:46 +01:00
- name: macOS aarch64
runner-os: macos-latest
artifact-name: lune-${{ needs.init.outputs.version }}-macos-aarch64
2023-05-06 08:01:46 +01:00
cargo-target: aarch64-apple-darwin
2023-01-19 01:47:14 +00:00
name: Build - ${{ matrix.name }}
runs-on: ${{ matrix.runner-os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
2023-01-19 01:47:14 +00:00
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
2023-01-19 01:47:14 +00:00
with:
targets: ${{ matrix.cargo-target }}
2023-01-19 01:47:14 +00:00
- name: Install Just
uses: extractions/setup-just@v1
- name: Install build tooling (aarch64-unknown-linux-gnu)
if: matrix.cargo-target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update -y
sudo apt-get install -y musl-tools clang llvm
2023-05-06 08:22:53 +01:00
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
2023-01-19 01:47:14 +00:00
- name: Build binary
run: just build --locked --release --target ${{ matrix.cargo-target }}
2023-01-19 01:47:14 +00:00
- name: Create release archive
run: just zip-release ${{ matrix.cargo-target }}
- name: Upload release artifact
2023-01-19 01:47:14 +00:00
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact-name }}
path: release.zip
release:
name: Release
runs-on: ubuntu-latest
needs: ["init", "build"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Just
uses: extractions/setup-just@v1
- name: Download releases
uses: actions/download-artifact@v3
2023-05-06 11:05:43 +01:00
with:
path: ./releases
- name: Unpack releases
run: just unpack-releases "./releases"
- name: Create release
uses: softprops/action-gh-release@v1
2023-01-19 01:47:14 +00:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ needs.init.outputs.version }}
tag_name: v${{ needs.init.outputs.version }}
fail_on_unmatched_files: true
files: ./releases/*.zip
draft: true