-
Notifications
You must be signed in to change notification settings - Fork 1
162 lines (139 loc) · 4.66 KB
/
Copy pathbuild.yml
File metadata and controls
162 lines (139 loc) · 4.66 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
name: Build and Package
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: app
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: app/package-lock.json
- name: Install dependencies
run: npm ci
- name: Typecheck (astro sync + tsc --noEmit)
run: npm run typecheck
env:
SESSION_SECRET: 'ci-test-secret-that-is-at-least-32-chars-long'
WALLET_RPC_URL: 'http://127.0.0.1:19999'
- name: Run unit tests with coverage
run: npm run test:coverage
env:
SESSION_SECRET: 'ci-test-secret-that-is-at-least-32-chars-long'
WALLET_RPC_URL: 'http://127.0.0.1:19999'
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage
path: app/coverage/
retention-days: 14
build:
needs: test
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write # needed to create GitHub Releases
steps:
- uses: actions/checkout@v7
- name: Verify tag matches package.json version
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG="${GITHUB_REF_NAME#v}"
PKG=$(node -p "require('./app/package.json').version")
if [[ "$TAG" != "$PKG" ]]; then
echo "Tag v${TAG} does not match app/package.json version ${PKG}"
exit 1
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
# Tags:
# v1.2.3 tag → mintlayer/web-gui:1.2.3, mintlayer/web-gui:1.2, mintlayer/web-gui:latest
# any tag → mintlayer/web-gui:sha-<short-sha>
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: mintlayer/web-gui
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest
type=sha,prefix=sha-,format=short
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ./app
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Package deploy files
run: |
mkdir mintlayer-gui
cp deploy/linux.sh mintlayer-gui/
cp deploy/mac.sh mintlayer-gui/
cp deploy/docker-compose.yml mintlayer-gui/
chmod +x mintlayer-gui/linux.sh mintlayer-gui/mac.sh
tar czf mintlayer-gui.tar.gz mintlayer-gui/
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: mintlayer-gui
path: mintlayer-gui.tar.gz
retention-days: 90
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: mintlayer-gui.tar.gz
generate_release_notes: true
deploy-pages:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- uses: actions/checkout@v7
- name: Prepare Pages content
run: |
mkdir _site
cp deploy/index.html _site/
cp deploy/CNAME _site/
# Installers + agent prompt
cp deploy/linux.sh _site/linux.sh
cp deploy/mac.sh _site/mac.sh
cp deploy/windows.ps1 _site/windows.ps1
cp deploy/agent-prompt.txt _site/agent-prompt.txt
chmod +x _site/linux.sh _site/mac.sh _site/windows.ps1
# Favicons (same files as www.mintlayer.org)
cp deploy/favicon.ico _site/favicon.ico
cp deploy/favicon.svg _site/favicon.svg
cp deploy/apple-touch-icon.svg _site/apple-touch-icon.svg
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: _site
- name: Deploy to GitHub Pages
id: deploy
uses: actions/deploy-pages@v4