forked from JohnnyMorganz/StyLua
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (73 loc) · 2.54 KB
/
release.yml
File metadata and controls
85 lines (73 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Release
on:
push:
tags: ["*"]
workflow_dispatch:
permissions:
contents: write
jobs:
release:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
artifact-name: stylua-windows-x86_64
cargo-target: x86_64-pc-windows-msvc
- os: ubuntu-22.04
artifact-name: stylua-linux-x86_64
cargo-target: x86_64-unknown-linux-gnu
- os: ubuntu-22.04
artifact-name: stylua-linux-x86_64-musl
cargo-target: x86_64-unknown-linux-musl
- os: ubuntu-22.04-arm
artifact-name: stylua-linux-aarch64
cargo-target: aarch64-unknown-linux-gnu
- os: ubuntu-22.04-arm
artifact-name: stylua-linux-aarch64-musl
cargo-target: aarch64-unknown-linux-musl
- os: macos-latest
artifact-name: stylua-macos-x86_64
cargo-target: x86_64-apple-darwin
- os: macos-latest
artifact-name: stylua-macos-aarch64
cargo-target: aarch64-apple-darwin
name: Build ${{ matrix.artifact-name }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.cargo-target }}
- name: Install musl tools
if: contains(matrix.cargo-target, 'musl') && runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Build binary
run: cargo build --verbose --locked --release --features lua52,lua53,lua54,luau,luajit,cfxlua --target ${{ matrix.cargo-target }}
env:
CARGO_TARGET_DIR: output
- name: Package binary
shell: bash
run: |
mkdir -p staging
if [ "${{ runner.os }}" = "Windows" ]; then
cp "output/${{ matrix.cargo-target }}/release/stylua.exe" staging/
cd staging
7z a ../${{ matrix.artifact-name }}.zip *
else
cp "output/${{ matrix.cargo-target }}/release/stylua" staging/
chmod +x staging/stylua
cd staging
zip ../${{ matrix.artifact-name }}.zip *
fi
- name: Upload workflow artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: ${{ matrix.artifact-name }}.zip
- name: Upload release asset
uses: softprops/action-gh-release@v2
with:
draft: true
files: ${{ matrix.artifact-name }}.zip