lune/.github/workflows/release.yaml

167 lines
5.2 KiB
YAML
Raw Normal View History

2023-01-19 01:47:14 +00:00
name: Release
on:
workflow_dispatch:
permissions:
contents: write
2023-01-19 01:47:14 +00:00
jobs:
2023-02-06 00:13:58 +00:00
create-release:
name: Create release
2023-01-19 01:47:14 +00:00
runs-on: ubuntu-latest
outputs:
manifest_version: ${{ steps.get_version.outputs.value }}
2023-02-06 00:13:58 +00:00
upload_url: ${{ steps.create_release.outputs.upload_url }}
2023-01-19 01:47:14 +00:00
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get version from manifest
uses: SebRollen/toml-action@0ad94c4a52c402aaa76e14e8a43551163b6cedf9
id: get_version
with:
file: Cargo.toml
2023-02-06 00:24:53 +00:00
field: workspace.package.version
2023-01-19 01:47:14 +00:00
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
2023-02-06 00:13:58 +00:00
tag_name: v${{ steps.get_version.outputs.value }}
release_name: ${{ steps.get_version.outputs.value }}
2023-01-19 01:47:14 +00:00
draft: true
assets:
2023-02-06 00:13:58 +00:00
needs: ["create-release"]
strategy:
matrix:
include:
- name: Selene type definitions
cargo-args: "--generate-selene-types"
file-name: "lune.yml"
file-type: "application/x-yaml"
- name: Luau type definitions
cargo-args: "--generate-luau-types"
file-name: "luneTypes.d.luau"
file-type: "application/x-luau"
- name: Luau LSP documentation
cargo-args: "--generate-docs-file"
file-name: "luneDocs.json"
file-type: "application/json"
name: Generate - ${{ matrix.name }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Generate file
run: cargo run --package lune-cli -- ${{ matrix.cargo-args }}
- name: Upload file to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ matrix.file-name }}
asset_name: ${{ matrix.file-name }}
asset_content_type: ${{ matrix.file-type }}
2023-01-19 01:47:14 +00:00
release:
2023-02-06 00:23:12 +00:00
needs: ["create-release"]
2023-01-19 01:47:14 +00:00
strategy:
matrix:
include:
- name: Windows x86_64
runner-os: windows-latest
2023-02-06 00:13:58 +00:00
artifact-name: lune-${{ needs.create-release.outputs.manifest_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
- name: Windows aarch64
runner-os: windows-latest
artifact-name: lune-${{ needs.create-release.outputs.manifest_version }}-windows-aarch64
cargo-target: aarch64-pc-windows-msvc
2023-01-19 01:47:14 +00:00
- name: Linux x86_64
runner-os: ubuntu-latest
2023-02-06 00:13:58 +00:00
artifact-name: lune-${{ needs.create-release.outputs.manifest_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.create-release.outputs.manifest_version }}-linux-aarch64
cargo-target: aarch64-unknown-linux-gnu
2023-01-19 01:47:14 +00:00
- name: macOS x86_64
runner-os: macos-latest
2023-02-06 00:13:58 +00:00
artifact-name: lune-${{ needs.create-release.outputs.manifest_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.create-release.outputs.manifest_version }}-macos-aarch64
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@v3
- 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 tooling
if: matrix.runner-os == 'ubuntu-latest'
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
2023-02-06 00:13:58 +00:00
run: cargo build --package lune-cli --locked --release --all-features --target ${{ matrix.cargo-target }}
2023-01-19 01:47:14 +00:00
env:
CARGO_TARGET_DIR: output
- name: Create binary archive
shell: bash
run: |
mkdir -p staging
if [ "${{ matrix.runner-os }}" = "windows-latest" ]; then
2023-02-06 00:13:58 +00:00
cp "output/${{ matrix.cargo-target }}/release/lune.exe" staging/
2023-01-19 01:47:14 +00:00
cd staging
7z a ../release.zip *
else
2023-02-06 00:13:58 +00:00
cp "output/${{ matrix.cargo-target }}/release/lune" staging/
2023-01-19 01:47:14 +00:00
cd staging
2023-05-06 08:01:46 +01:00
chmod +x lune
2023-01-19 01:47:14 +00:00
zip ../release.zip *
fi
- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact-name }}
path: release.zip
- name: Upload binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: release.zip
asset_name: ${{ matrix.artifact-name }}.zip
asset_content_type: application/zip