1
1
name : release
2
2
on :
3
3
push :
4
- tags :
5
- - " v[0-9]+.[0-9]+.[0-9]+ "
4
+ branches :
5
+ - main
6
6
7
7
concurrency :
8
8
group : ${{ github.sha }}
9
9
cancel-in-progress : true
10
10
11
11
jobs :
12
12
build-release :
13
- name : build-release ${{ matrix.os }}
13
+ name : build-release ${{ matrix.os }} ${{ matrix.rust }} ${{ matrix.target }}
14
14
runs-on : ${{ matrix.os }}
15
15
timeout-minutes : 5
16
16
strategy :
@@ -24,19 +24,36 @@ jobs:
24
24
os : macos-latest
25
25
rust : stable
26
26
target : x86_64-apple-darwin
27
+ - build : macos-arm64
28
+ os : macos-latest
29
+ rust : stable
30
+ target : aarch64-apple-darwin
27
31
env :
28
32
RUST_BACKTRACE : full
29
33
TARGET_DIR : ./target
30
34
steps :
31
35
- name : Checkout repository
32
36
uses : actions/checkout@v2
33
37
34
- - name : Get the release version from the tag
38
+ - name : Determine version changes
39
+ id : version_check
35
40
shell : bash
36
- if : env.FLOPHA_VERSION == ''
37
41
run : |
38
- echo "FLOPHA_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
39
- echo "version is: ${{ env.FLOPHA_VERSION }}"
42
+ latest_release=$(curl -s -H "Authorization: token ${{ github.token }}" \
43
+ https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name')
44
+ echo "Latest release version: $latest_release"
45
+
46
+ cargo_version=$(grep -m1 '^version\s*=' Cargo.toml | awk -F '"' '{print $2}')
47
+ echo "Cargo version: $cargo_version"
48
+
49
+ if [ "$latest_version" != "$cargo_version" ]; then
50
+ echo "Version has changed to $cargo_version"
51
+ echo "version_changed=true" >> $GITHUB_OUTPUT
52
+ echo "NEW_VERSION=$cargo_version" >> $GITHUB_ENV
53
+ else
54
+ echo "Version has not changed"
55
+ echo "version_changed=false" >> $GITHUB_OUTPUT
56
+ fi
40
57
41
58
- name : Install packages (Ubuntu)
42
59
if : matrix.os == 'ubuntu-20.04'
51
68
profile : minimal
52
69
override : true
53
70
71
+ - name : Skip if version has not changed
72
+ if : steps.version_check.outputs.version_changed != 'true'
73
+ run : |
74
+ echo "Version has not changed, skipping release"
75
+ exit 78
76
+
54
77
- name : Build and Package
55
78
shell : bash
56
79
run : |
60
83
- name : Upload release archive
61
84
uses : softprops/action-gh-release@v2
62
85
with :
63
- tag_name : ${{ env.FLOPHA_VERSION }}
86
+ tag_name : ${{ env.NEW_VERSION }}
64
87
generate_release_notes : True
65
88
files : ${{ env.ASSET }}
0 commit comments