-
Notifications
You must be signed in to change notification settings - Fork 7
226 lines (205 loc) · 9.67 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:24.04
env:
RELEASE_TAG_NAME: ${{ needs.tagname.outputs.tag_name }}
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v3
- 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 wget curl
- 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 nostr-commander-rs
- name: Gzip
run: |
mkdir nostr-commander-rs
cp ./target/release/nostr-commander-rs nostr-commander-rs/
cp README.md nostr-commander-rs/
cp LICENSE nostr-commander-rs/
cp help.help.txt nostr-commander-rs/
cp help.manual.txt nostr-commander-rs/
cp help.usage.txt nostr-commander-rs/
tar -zcvf ./nostr-commander-rs_${TAG_NAME}_linux.tar.gz nostr-commander-rs
# tar -zcvf ./nostr-commander-rs_linux.tar.gz nostr-commander-rs
sha256sum ./nostr-commander-rs_${TAG_NAME}_linux.tar.gz > ./nostr-commander-rs_${TAG_NAME}_linux.tar.gz.sha256sum
echo "SHA256 checksum is: "
cat ./nostr-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: |
./nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz
./nostr-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 }}
# error: linking with `/opt/osxcross/target/bin/x86_64-apple-darwin14-clang` failed: exit status: 1
# = note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET LC_ALL="C" PATH="/usr/local/rustup/toolchains/1.76.0-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/bin:/opt/osxcross/target/bin:/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" ZERO_AR_DATE="1" "/opt/osxcross/target/bin/x86_64-apple-darwin14-clang" "-arch" "x86_64" "-m64" "/tmp/rustcMaqGbI/symbols.o" "/github/workspace/./target/x86_64-apple-darwin/release/deps/nostr_commander_rs-d8f4107325f6cff0.nostr_commander_rs.d13df3b232ebb334-cgu.00.rcgu.o" "-L" "/github/workspace/./target/x86_64-apple-darwin/release/deps" "-L" "/github/workspace/./target/release/deps" "-L" "/github/workspace/./target/x86_64-apple-darwin/release/build/ring-d6c03c4e1567ca2d/out" "-L" "/github/workspace/./target/x86_64-apple-darwin/release/build/secp256k1-sys-1f00d2d20ca4260f/out" "-L" "/usr/local/rustup/toolchains/1.76.0-x86_64-unknown-linux-musl/lib/rustlib/x
# = note: ld: warning: object file (/tmp/rustcMaqGbI/symbols.o) was built for newer macOS version (10.12) than being linked (10.8)
# ld: warning: object file (/github/workspace/./target/x86_64-apple-darwin/release/deps/nostr_commander_rs-d8f4107325f6cff0.nostr_commander_rs.d13df3b232ebb334-cgu.00.rcgu.o) was built for newer macOS version (10.12) than being linked (10.8)
# In Sept 2024 linking failed
# - 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 nostr-commander-rs_null_x86_64-pc-windows-gnu.zip nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-pc-windows-gnu.zip
#mv nostr-commander-rs_null_x86_64-pc-windows-gnu.zip.sha256sum nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-pc-windows-gnu.zip.sha256sum
#mv nostr-commander-rs_null_x86_64-unknown-linux-musl.zip nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-unknown-linux-musl.zip
#mv nostr-commander-rs_null_x86_64-unknown-linux-musl.zip.sha256sum nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-unknown-linux-musl.zip.sha256sum
#mv nostr-commander-rs_null_x86_64-apple-darwin.zip nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-apple-darwin.zip
#mv nostr-commander-rs_null_x86_64-apple-darwin.zip.sha256sum nostr-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
nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz.sha256sum
nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_linux.tar.gz
output/nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-pc-windows-gnu.zip
output/nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-pc-windows-gnu.zip.sha256sum
output/nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-unknown-linux-musl.zip
output/nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-unknown-linux-musl.zip.sha256sum
# output/nostr-commander-rs_${{ env.RELEASE_TAG_NAME }}_x86_64-apple-darwin.zip
# output/nostr-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 }}