-
Notifications
You must be signed in to change notification settings - Fork 9
226 lines (200 loc) · 8.19 KB
/
release-by-label.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# .github/workflow/release-by-label.yml
# automatically perform release when a version tag is pushed via git
name: "tagged-release"
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: false
default: nightly
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TERM_COLOR: always
jobs:
tagname:
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.tag.outputs.tag }}
steps:
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- id: vars
shell: bash
run: echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
- if: env.TAG_NAME == 'nightly'
run: echo 'TAG_NAME=nightly-${{ steps.vars.outputs.sha_short }}' >> $GITHUB_ENV
- id: tag
run: echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
tagged-release:
name: "Tagged Release"
runs-on: "ubuntu-latest"
needs: tagname
container: ubuntu:18.04
env:
RELEASE_TAG_NAME: ${{ needs.tagname.outputs.tag_name }}
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v4
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'schedule'
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- name: Install dependencies
run: |
apt-get -y update
apt-get -y install cmake pkg-config libfontconfig-dev libgtk-3-dev libssl-dev libolm-dev rename
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
profile: minimal
- name: Build
run: cargo build --profile release --bin matrix-commander-rs
- name: Gzip
run: |
mkdir matrix-commander-rs
cp ./target/release/matrix-commander-rs matrix-commander-rs/
cp README.md matrix-commander-rs/
cp LICENSE matrix-commander-rs/
cp help.help.txt matrix-commander-rs/
cp help.manual.txt matrix-commander-rs/
cp help.usage.txt matrix-commander-rs/
tar -zcvf ./matrix-commander-rs_${TAG_NAME}_linux.tar.gz matrix-commander-rs
# tar -zcvf ./matrix-commander-rs_linux.tar.gz matrix-commander-rs
sha256sum ./matrix-commander-rs_${TAG_NAME}_linux.tar.gz > ./matrix-commander-rs_${TAG_NAME}_linux.tar.gz.sha256sum
echo "SHA256 checksum is: "
cat ./matrix-commander-rs_${TAG_NAME}_linux.tar.gz.sha256sum
ls
ls -l
echo ${TAG_NAME} > tag.txt
cat tag.txt
- name: Upload artifact Linux
uses: actions/upload-artifact@v3
with:
name: Binary
path: |
./matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz
./matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz.sha256sum
retention-days: 1
# this overwrites all files in the workspace, so files from before will be lost.
# - uses: actions/checkout@master
#
# This would compile and run test cases, but we have a separate Github action for that
# - name: Build
# run: cargo build --verbose
# - name: Run tests
# run: cargo test --verbose
- name: Compile
id: compile
uses: rust-build/rust-build.action@master
with:
RUSTTARGET: x86_64-pc-windows-gnu
UPLOAD_MODE: none
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Binary
path: |
${{ steps.compile.outputs.BUILT_ARCHIVE }}
${{ steps.compile.outputs.BUILT_CHECKSUM }}
- name: Compile
id: compile2
uses: rust-build/rust-build.action@master
with:
RUSTTARGET: x86_64-unknown-linux-musl
# ARCHIVE_TYPES: tar.gz
UPLOAD_MODE: none
MINIFY: true
EXTRA_FILES: "README.md LICENSE help.help.txt help.manual.txt help.usage.txt"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Binary
path: |
${{ steps.compile2.outputs.BUILT_ARCHIVE }}
${{ steps.compile2.outputs.BUILT_CHECKSUM }}
- name: Compile
id: compile3
uses: rust-build/rust-build.action@master
with:
RUSTTARGET: x86_64-apple-darwin
# ARCHIVE_TYPES: tar.gz
UPLOAD_MODE: none
MINIFY: true
EXTRA_FILES: "README.md LICENSE help.help.txt help.manual.txt help.usage.txt"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Binary
path: |
${{ steps.compile3.outputs.BUILT_ARCHIVE }}
${{ steps.compile3.outputs.BUILT_CHECKSUM }}
- name: Final-check
run: |
ls -l
echo "content of output directory"
ls -l output
TAG_NAME=$(cat tag.txt)
cat tag.txt
echo "tag name: $TAG_NAME"
echo "release tag: $RELEASE_TAG_NAME"
echo "env release tag: " ${{ env.RELEASE_TAG_NAME }}
echo "if rename not installed, will stop action if using rename"
echo $(which rename)
echo $(rename -h)
echo $(rename -v)
echo $(rename -V)
rename 's/_null_/_${{ env.RELEASE_TAG_NAME }}_/' output/*
#cd output
#ls
#mv matrix-commander-rs_null_x86_64-pc-windows-gnu.zip matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-pc-windows-gnu.zip
#mv matrix-commander-rs_null_x86_64-pc-windows-gnu.zip.sha256sum matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-pc-windows-gnu.zip.sha256sum
#mv matrix-commander-rs_null_x86_64-unknown-linux-musl.zip matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-unknown-linux-musl.zip
#mv matrix-commander-rs_null_x86_64-unknown-linux-musl.zip.sha256sum matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-unknown-linux-musl.zip.sha256sum
#mv matrix-commander-rs_null_x86_64-apple-darwin.zip matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-apple-darwin.zip
#mv matrix-commander-rs_null_x86_64-apple-darwin.zip.sha256sum matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-apple-darwin.zip.sha256sum
#cd ..
ls * output/*
# https://github.com/softprops/action-gh-release
# do wildcards like * work in files?
- name: Release
uses: "softprops/action-gh-release@v1"
with:
token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
generate_release_notes: true
files: |
README.md
LICENSE
matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz.sha256sum
matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz
output/matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-pc-windows-gnu.zip
output/matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-pc-windows-gnu.zip.sha256sum
output/matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-unknown-linux-musl.zip
output/matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-unknown-linux-musl.zip.sha256sum
output/matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-apple-darwin.zip
output/matrix-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-apple-darwin.zip.sha256sum
hel*.txt
# ${{ steps.compile.outputs.BUILT_ARCHIVE }}
# ${{ steps.compile.outputs.BUILT_CHECKSUM }}
# ${{ steps.compile2.outputs.BUILT_ARCHIVE }}
# ${{ steps.compile2.outputs.BUILT_CHECKSUM }}
# ${{ steps.compile3.outputs.BUILT_ARCHIVE }}
# ${{ steps.compile3.outputs.BUILT_CHECKSUM }}