-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (76 loc) · 2.65 KB
/
release.yml
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:
branches:
- main
concurrency:
group: ${{ github.sha }}
cancel-in-progress: true
jobs:
build-release:
name: build-release ${{ matrix.os }} ${{ matrix.rust }} ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
matrix:
include:
- build: linux
os: ubuntu-20.04
rust: stable
target: x86_64-unknown-linux-musl
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
- build: macos-arm64
os: macos-latest
rust: stable
target: aarch64-apple-darwin
env:
RUST_BACKTRACE: full
TARGET_DIR: ./target
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Determine version changes
id: version_check
shell: bash
run: |
latest_release=$(curl -s -H "Authorization: token ${{ github.token }}" \
https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name' | tr -d 'v')
echo "Latest release version: $latest_release"
cargo_version=$(grep -m1 '^version\s*=' Cargo.toml | awk -F '"' '{print $2}')
echo "Cargo version: $cargo_version"
if [ "$latest_release" != "$cargo_version" ]; then
echo "Version has changed to $cargo_version"
echo "version_changed=true" >> $GITHUB_OUTPUT
echo "NEW_VERSION=$cargo_version" >> $GITHUB_ENV
else
echo "Version has not changed"
echo "version_changed=false" >> $GITHUB_OUTPUT
fi
- name: Install packages (Ubuntu)
if: steps.version_check.outputs.version_changed == 'true' && matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Install Rust
if: steps.version_check.outputs.version_changed == 'true'
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- name: Build and Package
if: steps.version_check.outputs.version_changed == 'true'
shell: bash
run: |
scripts/package.sh --target ${{ matrix.target }}
echo "ASSET=dist/flopha-${{ matrix.target }}.tar.gz" >> $GITHUB_ENV
- name: Upload release archive
if: steps.version_check.outputs.version_changed == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.NEW_VERSION }}
generate_release_notes: True
files: ${{ env.ASSET }}