-
Notifications
You must be signed in to change notification settings - Fork 12
166 lines (150 loc) · 5.93 KB
/
publish-nym-vpn-app.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
name: publish-nym-vpn-app
on:
schedule:
- cron: "4 4 * * *"
workflow_dispatch:
inputs:
tag_name:
description: "Tag name for release"
required: false
default: nym-vpn-app-nightly
pre_release:
description: "Pre-release"
required: false
type: boolean
default: false
dev_mode:
description: "dev build (enable env selector)"
required: true
type: boolean
default: false
core_release_tag:
description: "nym-vpn-core release tag to use for Windows build (as it bundles the daemon)"
required: false
type: string
push:
tags:
- nym-vpn-app-v[0-9]+.[0-9]+.[0-9]+*
jobs:
build-nym-vpn-app-linux:
uses: ./.github/workflows/build-nym-vpn-app-linux.yml
with:
dev_mode: ${{ github.event_name == 'schedule' || contains(github.ref_name, 'dev') || contains(github.ref_name, 'nightly') || inputs.dev_mode == true }}
secrets: inherit
build-nym-vpn-app-windows:
uses: ./.github/workflows/build-nym-vpn-app-windows.yml
with:
dev_mode: ${{ github.event_name == 'schedule' || contains(github.ref_name, 'dev') || contains(github.ref_name, 'nightly') || inputs.dev_mode == true }}
core_release_tag: ${{ inputs.core_release_tag }}
secrets: inherit
generate-build-info-nym-vpn-app:
uses: ./.github/workflows/generate-build-info-nym-vpn-app.yml
needs: build-nym-vpn-app-linux
with:
build-profile: release
rust-version: ${{ needs.build-nym-vpn-app-linux.outputs.RUST_VERSION }}
publish:
needs:
- build-nym-vpn-app-linux
- build-nym-vpn-app-windows
- generate-build-info-nym-vpn-app
runs-on: ubuntu-22.04
outputs:
tag: ${{ steps.set_tag.outputs.tag }}
env:
# GH needed for gh cli
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PKG_VERSION: ${{ needs.build-nym-vpn-app-linux.outputs.PKG_VERSION }}
UPLOAD_DIR_UBUNTU_22: ${{ needs.build-nym-vpn-app-linux.outputs.UPLOAD_DIR_LINUX }}
UPLOAD_DIR_WINDOWS: ${{ needs.build-nym-vpn-app-windows.outputs.UPLOAD_DIR_WINDOWS }}
permissions: write-all
steps:
- name: Checkout repo
uses: actions/checkout@v4
# Adding envsubst, gh cli
- name: Install system dependencies
run: |
sudo apt update && sudo apt install -y gettext-base gh
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Get package version
id: package-version
uses: nicolaiunrein/cargo-get@master
with:
subcommand: package.version --entry nym-vpn-app/src-tauri
- name: Check tag name consistency
if: github.event_name == 'push'
shell: bash
run: |
if [[ nym-vpn-app-v${{ steps.package-version.outputs.metadata }} != ${{ github.ref_name }} ]]; then
exit 1
fi
- name: Download artifacts
uses: actions/download-artifact@v4
# Setup TAG_NAME, which is used as a general "name"
- 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=nym-vpn-app-nightly" >> $GITHUB_ENV
- if: github.event_name == 'push'
run: echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Set tag
id: set_tag
run: echo "tag=${{ env.TAG_NAME }}" >> "$GITHUB_OUTPUT"
- name: Setting subject, prerelease and notes files (nightly)
if: ${{ contains(env.TAG_NAME, 'nym-vpn-app-nightly') }}
run: |
(echo "SUBJECT=nym-vpn-app-v${{ steps.package-version.outputs.metadata }} nightly prerelease build";
echo 'PRERELEASE=--prerelease';
echo 'NOTES_FILE=release-notes/release-notes-vpn-app-nightly.md') >> $GITHUB_ENV
gh release delete nym-vpn-app-nightly --yes || true
git push origin :nym-vpn-app-nightly || true
- name: Setting subject, prerelease and notes files
if: ${{ !contains(env.TAG_NAME, 'nym-vpn-app-nightly') }}
run: |
(echo "SUBJECT=$TAG_NAME"
echo 'PRERELEASE=${{ inputs.pre_release && '--prerelease' || '' }}';
echo 'NOTES_FILE=release-notes/release-notes-vpn-app.md') >> $GITHUB_ENV
- name: Generate checksums
run: |
pushd ${{ env.UPLOAD_DIR_UBUNTU_22 }} || exit 1
for f in *; do sha256sum "$f" > "$f.sha256sum"; done
popd
pushd ${{ env.UPLOAD_DIR_WINDOWS }} || exit 1
for f in *; do sha256sum "$f" > "$f.sha256sum"; done
popd
echo 'SHA256_CHECKSUMS<<EOF' >> $GITHUB_ENV
cat ${{ env.UPLOAD_DIR_UBUNTU_22 }}/*.sha256sum >> $GITHUB_ENV
cat ${{ env.UPLOAD_DIR_WINDOWS }}/*.sha256sum >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Build info
run: |
echo 'BUILD_INFO<<EOF' >> $GITHUB_ENV
cat build-info/build-info.txt >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Publish release
run: |
echo "build info"
echo "$BUILD_INFO"
echo "checksums"
echo "$SHA256_CHECKSUMS"
echo "Creating release notes"
envsubst < "$GITHUB_WORKSPACE/.github/workflows/$NOTES_FILE" > "$RUNNER_TEMP/release-notes.md"
echo "Creating release nodes: output"
cat $RUNNER_TEMP/release-notes.md
echo "Creating release"
gh release create $TAG_NAME ${{ env.PRERELEASE }} \
--notes-file "$RUNNER_TEMP/release-notes.md" \
--title "$SUBJECT" \
--target $GITHUB_SHA \
${{ env.UPLOAD_DIR_UBUNTU_22}}/* \
${{ env.UPLOAD_DIR_WINDOWS}}/*
gen-hashes:
uses: ./.github/workflows/gen-hashes-json.yml
needs: publish
with:
release_tag: ${{ needs.publish.outputs.tag }}
secrets: inherit