-
Notifications
You must be signed in to change notification settings - Fork 2
209 lines (201 loc) · 8.45 KB
/
apps_wallet_build.yml
File metadata and controls
209 lines (201 loc) · 8.45 KB
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
name: Build Wallet App
on:
push:
tags:
- "wallet-v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
inputs:
deploy_type:
description: "Deploy type"
required: true
type: choice
options:
- rc
- production
rc_version:
description: "The RC numeric version (only used for RC builds)"
type: string
required: false
jobs:
resolve-deploy-type:
runs-on: ubuntu-latest
outputs:
deploy_type: ${{ steps.resolve.outputs.deploy_type }}
environment: ${{ steps.resolve.outputs.environment }}
apps_backend_secret: ${{ steps.resolve.outputs.apps_backend_secret }}
default_network_secret: ${{ steps.resolve.outputs.default_network_secret }}
iota_networks_secret: ${{ steps.resolve.outputs.iota_networks_secret }}
rc_version: ${{ steps.resolve.outputs.rc_version }}
steps:
- name: Resolve deploy type
id: resolve
run: |
if [ "${{ github.event_name }}" = "push" ]; then
DEPLOY_TYPE="production"
else
DEPLOY_TYPE="${{ inputs.deploy_type }}"
fi
case "$DEPLOY_TYPE" in
rc)
ENVIRONMENT="RC – wallet"
APPS_BACKEND_SECRET="RC_APPS_BACKEND"
DEFAULT_NETWORK_SECRET="WALLET_RC_DEFAULT_NETWORK"
IOTA_NETWORKS_SECRET="WALLET_RC_IOTA_NETWORKS"
RC_VERSION="${{ inputs.rc_version }}"
if [ -z "$RC_VERSION" ]; then
echo "::error::rc_version is required for RC builds"
exit 1
fi
;;
production)
ENVIRONMENT="Production – wallet"
APPS_BACKEND_SECRET="PROD_APPS_BACKEND"
DEFAULT_NETWORK_SECRET="WALLET_PROD_DEFAULT_NETWORK"
IOTA_NETWORKS_SECRET="WALLET_PROD_IOTA_NETWORKS"
RC_VERSION=""
;;
esac
echo "deploy_type=$DEPLOY_TYPE" >> "$GITHUB_OUTPUT"
echo "environment=$ENVIRONMENT" >> "$GITHUB_OUTPUT"
echo "apps_backend_secret=$APPS_BACKEND_SECRET" >> "$GITHUB_OUTPUT"
echo "default_network_secret=$DEFAULT_NETWORK_SECRET" >> "$GITHUB_OUTPUT"
echo "iota_networks_secret=$IOTA_NETWORKS_SECRET" >> "$GITHUB_OUTPUT"
echo "rc_version=$RC_VERSION" >> "$GITHUB_OUTPUT"
wallet-build:
needs: resolve-deploy-type
runs-on: ubuntu-latest
environment: ${{ needs.resolve-deploy-type.outputs.environment }}
permissions:
contents: write
outputs:
artifact_name: ${{ steps.artifact.outputs.artifact_name }}
release_tag: ${{ steps.prev_tag.outputs.current_tag }}
artifact_link: ${{ steps.artifact-link.outputs.artifact_link }}
env:
DEFAULT_NETWORK: ${{ secrets[needs.resolve-deploy-type.outputs.default_network_secret] }}
IOTA_NETWORKS: ${{ secrets[needs.resolve-deploy-type.outputs.iota_networks_secret] }}
APPS_BACKEND: ${{ secrets[needs.resolve-deploy-type.outputs.apps_backend_secret] }}
SENTRY_AUTH_TOKEN: ${{ secrets.TOOLING_SENTRY_AUTH_TOKEN }}
DEPLOY_TYPE: ${{ needs.resolve-deploy-type.outputs.deploy_type }}
RC_VERSION: ${{ needs.resolve-deploy-type.outputs.rc_version }}
steps:
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-tags: ${{ env.DEPLOY_TYPE == 'production' }}
fetch-depth: ${{ env.DEPLOY_TYPE == 'production' && '0' || '1' }}
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- name: Install Nodejs
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "24"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@3cf273023a0dda27efcd3164bdfb51908dd46a5b # v1.3.1
with:
path: apps/wallet
- name: Create artifact name
id: artifact
shell: bash
run: |
if [ "$DEPLOY_TYPE" = "rc" ]; then
export artifact_name="iota-wallet-${{ steps.package-version.outputs.current-version }}-rc.${RC_VERSION}"
else
export artifact_name="iota-wallet-${{ steps.package-version.outputs.current-version }}"
fi
echo "artifact_name=${artifact_name}" >> $GITHUB_ENV
echo "artifact_name=${artifact_name}" >> $GITHUB_OUTPUT
- name: Get Previous Tag
if: env.DEPLOY_TYPE == 'production'
id: prev_tag
run: |
tags=$(git tag --list 'wallet-v*.*.*' --sort=-creatordate)
current_tag=$(echo "$tags" | sed -n 1p)
prev_tag=$(echo "$tags" | sed -n 2p)
if [ -z "$prev_tag" ]; then
echo "No previous tag found. Skipping changelog generation."
echo "PREV_TAG=none" >> $GITHUB_ENV
else
echo "PREV_TAG=$prev_tag" >> $GITHUB_ENV
fi
echo "CURRENT_TAG=$current_tag" >> $GITHUB_ENV
echo "current_tag=$current_tag" >> $GITHUB_OUTPUT
- name: Generate Changelog
if: env.DEPLOY_TYPE == 'production'
id: generate_changelog
run: |
if [ "${{ env.PREV_TAG }}" = "none" ]; then
echo "No previous tag found. Skipping changelog generation."
echo "changelog=No previous tag found. Changelog generation skipped." >> $GITHUB_OUTPUT
else
echo "## Changelog" > CHANGELOG.md
git log ${{ env.PREV_TAG }}..${{ env.CURRENT_TAG }} --pretty=format:"- %s in #%h" -- ./apps/wallet >> CHANGELOG.md
cat CHANGELOG.md
fi
- name: Get version from tag
if: env.DEPLOY_TYPE == 'production'
id: version
run: echo "version=${GITHUB_REF#refs/tags/wallet-v}" >> "$GITHUB_OUTPUT"
- name: Build Chrome Wallet
run: |
if [ "$DEPLOY_TYPE" = "rc" ]; then
pnpm wallet build:rc
else
pnpm wallet build
fi
- name: Upload Chrome artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: chrome-${{ env.artifact_name }}
path: |
./apps/wallet/dist
- name: Build Firefox Wallet
run: |
if [ "$DEPLOY_TYPE" = "rc" ]; then
pnpm wallet build:firefox:rc
else
pnpm wallet build:firefox
fi
- name: Upload Firefox artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: firefox-${{ env.artifact_name }}
path: |
./apps/wallet/dist
- name: Create GitHub Release
if: env.DEPLOY_TYPE == 'production'
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.CURRENT_TAG }}
name: IOTA Wallet v${{ steps.version.outputs.version }}
draft: true
prerelease: false
body_path: CHANGELOG.md
- name: Compose artifact link for Slack
id: artifact-link
if: always()
shell: bash
run: |
if [ "$DEPLOY_TYPE" = "production" ]; then
echo "artifact_link=Release: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${CURRENT_TAG}" >> "$GITHUB_OUTPUT"
else
echo "artifact_link=Artifacts: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts" >> "$GITHUB_OUTPUT"
fi
notify:
needs: [resolve-deploy-type, wallet-build]
if: always() && needs.wallet-build.result != 'skipped' && (needs.resolve-deploy-type.outputs.deploy_type == 'rc' || needs.resolve-deploy-type.outputs.deploy_type == 'production')
uses: ./.github/workflows/_slack_notify.yml
secrets: inherit
with:
status: ${{ needs.wallet-build.result == 'success' && 'success' || 'failure' }}
title: "Wallet ${{ needs.resolve-deploy-type.outputs.deploy_type }} build ${{ needs.wallet-build.result }}"
message: |
Environment: ${{ needs.resolve-deploy-type.outputs.deploy_type }}
Artifact: ${{ needs.wallet-build.outputs.artifact_name }}
${{ needs.wallet-build.outputs.artifact_link }}
Workflow Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}