-
-
Notifications
You must be signed in to change notification settings - Fork 37
140 lines (121 loc) · 4.24 KB
/
release.yaml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Release
on:
push:
tags: [ 'v*' ]
jobs:
tests:
uses: ./.github/workflows/test.yaml
cargo-release:
if: !endsWith(github.ref, '-test')
needs: [ tests ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
with:
toolchain: stable
- run: cargo install cargo-release
- run: cargo login ${{ secrets.CARGO_TOKEN }}
- run: cargo release --no-dev-version --skip-push --skip-tag --no-confirm
github-release:
needs: [ tests ]
strategy:
matrix:
target:
# Linux build notes:
# While musl targets are not as supported as gnu, those are most relevant to users,
# which want to download binaries from github, as glibc has compatibility issues
# with older distros
# Tier 1
- i686-pc-windows-msvc
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
# Tier 2
- aarch64-apple-darwin
- aarch64-unknown-linux-musl
- i686-unknown-linux-musl
- x86_64-unknown-linux-musl
include:
# Linux
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
bin: jrsonnet
name: jrsonnet-linux-aarch64
- target: i686-unknown-linux-musl
os: ubuntu-latest
bin: jrsonnet
name: jrsonnet-linux-i686
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
bin: jrsonnet
name: jrsonnet-linux-amd64
# Windows
- target: i686-pc-windows-msvc
os: windows-latest
bin: jrsonnet.exe
name: jrsonnet-windows-i686.exe
- target: x86_64-pc-windows-msvc
os: windows-latest
bin: jrsonnet.exe
name: jrsonnet-windows-amd64.exe
# Apple
- target: aarch64-apple-darwin
os: macOS-latest
bin: jrsonnet
name: jrsonnet-darwin-aarch64
- target: x86_64-apple-darwin
os: macOS-latest
bin: jrsonnet
name: jrsonnet-darwin-amd64
runs-on: ${{ matrix.os }}
steps:
- name: Fetch apt repo updates
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
run: sudo apt update
- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
with:
toolchain: stable
target: ${{ matrix.target }}
- uses: actions/checkout@v4.1.4
- name: Add experimental flags
if: ${{ endsWith(github.ref, '-test' )}}
run: echo 'EXPERIMENTAL_FLAGS=--features=experimental' >> $GITHUB_ENV
- name: Linux x86 cross compiler
if: ${{ startsWith(matrix.target, 'i686-unknown-linux-') }}
run: sudo apt install gcc-multilib
- name: ARM cross compiler
if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
uses: actions-rs/cargo@v1
with:
command: install
args: cross
- name: ARM gcc
if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
run: sudo apt install gcc-aarch64-linux-gnu
- name: Musl gcc
if: ${{ endsWith(matrix.target, '-musl') }}
run: sudo apt install musl musl-tools
- name: Run cross build
if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
shell: bash
run: cross build --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }}
- name: Run build
if: ${{ !startsWith(matrix.target, 'aarch64-unknown-linux-') }}
run: cargo build --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }}
- name: Package
shell: bash
run: |
cd target/${{ matrix.target }}/release
cp ${{ matrix.bin }} ../../../${{ matrix.name }}
cd -
- name: Generate SHA-256
run: shasum -a 256 ${{ matrix.name }} > ${{ matrix.name }}.sha256
- name: Publish
uses: softprops/action-gh-release@v2.0.4
with:
draft: true
files: "jrsonnet*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}