-
-
Notifications
You must be signed in to change notification settings - Fork 7
157 lines (130 loc) · 4.05 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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Release
on:
push:
tags: ["*"]
jobs:
bump:
name: Bump Version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Update Changelog
uses: thomaseizinger/keep-a-changelog-new-release@v3
with:
tag: ${{ github.ref_name }}
- name: Bump Cargo version
id: version-bump
uses: DervexDev/file-version-bumper@v1
with:
path: ./Cargo.toml
- name: Update Cargo lock
run: cargo update --workspace
- name: Commit and Push
uses: EndBug/add-and-commit@v9
if: ${{ github.ref_name != steps.version-bump.outputs.old_version }}
with:
message: Bump version to ${{ github.ref_name }}
default_author: github_actions
- name: Update tag
if: ${{ github.ref_name != steps.version-bump.outputs.old_version }}
run: |
git tag -fa ${{ github.ref_name }} -m "Release ${{ github.ref_name }}"
git push -f --tags
draft-release:
name: Draft Release
runs-on: ubuntu-latest
needs: bump
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
release_id: ${{ steps.create-release.outputs.id }}
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Read Changelog
id: read-changes
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ github.ref_name }}
- name: Create Release
id: create-release
uses: shogo82148/actions-create-release@v1
with:
release_name: ${{ github.ref_name }}
body: ${{ steps.read-changes.outputs.changes }}
prerelease: ${{ contains(github.ref_name, 'pre') }}
draft: true
build:
name: Build (${{ matrix.label }})
runs-on: ${{ matrix.os }}
needs: draft-release
strategy:
matrix:
include:
# x86_64
- host: linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
label: linux-x86_64
- host: macos
os: macos-latest
target: x86_64-apple-darwin
label: macos-x86_64
- host: windows
os: windows-latest
target: x86_64-pc-windows-msvc
label: windows-x86_64
# aarch64
- host: macos
os: macos-latest
target: aarch64-apple-darwin
label: macos-aarch64
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Setup Rust
uses: hecrj/setup-rust-action@v2
with:
targets: ${{ matrix.target }}
- name: Build
run: cargo build --all-features --release --verbose --target ${{ matrix.target }}
env:
ARGON_TOKEN: ${{ secrets.ARGON_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Archive
shell: bash
run: |
mkdir release
if [ "${{ matrix.host }}" = "windows" ]; then
cp "target/${{ matrix.target }}/release/argon.exe" release/
cd release
7z a ../release.zip *
else
cp "target/${{ matrix.target }}/release/argon" release/
cd release
zip ../release.zip *
fi
- name: Upload to Artifacts
uses: actions/upload-artifact@v4
with:
name: argon-${{ github.ref_name }}-${{ matrix.label }}.zip
path: release.zip
- name: Upload to Release
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.draft-release.outputs.upload_url }}
asset_name: argon-${{ github.ref_name }}-${{ matrix.label }}.zip
asset_path: release.zip
publish-release:
name: Publish Release
runs-on: ubuntu-latest
needs: [build, draft-release]
steps:
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.draft-release.outputs.release_id }}