-
Notifications
You must be signed in to change notification settings - Fork 0
283 lines (235 loc) · 8.66 KB
/
Copy pathdeploy.yml
File metadata and controls
283 lines (235 loc) · 8.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
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
name: Nuxt CD
run-name: ${{ github.ref_name }}
permissions:
contents: write
packages: write
attestations: write
id-token: write
on:
release:
types:
- published
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
env:
REPO: ${{ github.repository }}
USERNAME: ${{ vars.USERNAME }}
VERSION: ${{ github.ref_name }}
DATABASE_URL: ${{ vars.DATABASE_URL }}
jobs:
build-web:
runs-on: ubuntu-latest
outputs:
image_name: ${{ steps.metadata.outputs.image_name }}
image_title: ${{ steps.metadata.outputs.image_title }}
buildtime: ${{ steps.metadata.outputs.buildtime }}
version: ${{ steps.metadata.outputs.version }}
steps:
- name: 📥 Checkout Repo
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: 🐋 Set up QEMU
uses: docker/setup-qemu-action@v4
- name: 🐋 Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: 🐋 Extract Docker metadata
id: meta
uses: docker/metadata-action@v6
with:
images: |
ghcr.io/${{ env.REPO }}
# docker.io/${{ env.REPO }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=sha-,format=short
- name: 🏷️ Set tags as environment variable
id: metadata
run: |
echo "Setting metadata to env variables"
echo "image_name=${{ fromJSON(steps.meta.outputs.json).tags[0] }}" >> $GITHUB_OUTPUT
echo "image_title=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.title'] }}" >> $GITHUB_OUTPUT
echo "buildtime=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}" >> $GITHUB_OUTPUT
echo "version=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}" >> $GITHUB_OUTPUT
- name: 🐋 Log in to Github Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ env.USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}
# - name: Log in to DockerHub
# uses: docker/login-action@v4
# with:
# registry: docker.io
# username: ${{ env.USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: ⚙️ Build and Upload to Registries
id: push
uses: docker/build-push-action@v7
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ steps.metadata.outputs.version }}
BUILD_TIME=${{ steps.metadata.outputs.buildtime }}
SITE_URL=${{ vars.SITE_URL }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: 📝 Generate artifact attestation
uses: actions/attest-build-provenance@v4
with:
subject-name: ghcr.io/${{ env.REPO }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: false
# deploy-web:
# needs: build-web
# runs-on: ubuntu-latest
# steps:
# - name: 🔀 Deploy to VPS
# uses: appleboy/ssh-action@v1.1.0
# with:
# host: ${{ secrets.VPS_HOST }}
# username: ${{ secrets.VPS_USERNAME }}
# password: ${{ secrets.VPS_PASSWORD }}
# script: |
# cd ~/${{ env.REPO }}
# curl -O https://raw.githubusercontent.com/${{ env.REPO }}/refs/heads/main/docker-compose.prod.yml
# docker stack deploy --compose-file docker-compose.prod.yml nuxtemplate
build-desktop:
env:
PLATFORM_ENV: native
NUXT_PUBLIC_SITE_URL: ${{ vars.SITE_URL }}
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest' # for Arm based macs (M1 and above).
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest' # for Intel based macs.
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-latest'
args: ''
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
- name: 📥 Checkout Repo
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Install OS Dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-latest' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: 🛠️ Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' &&
'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: 🛠️ Setup Vite-Plus
uses: voidzero-dev/setup-vp@v1
with:
node-version: 'lts/*'
cache: true
- name: 🛠️ Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: 📦 Install Dependencies
run: bun install --frozen-lockfile
- name: ⚙️ Build and Upload Artifact
uses: tauri-apps/tauri-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
args: ${{ matrix.args }}
tagName: v__VERSION__
releaseName: 'v__VERSION__'
releaseDraft: false
prerelease: false
# deploy-desktop:
# needs: build-desktop
# runs-on: ubuntu-latest
build-mobile:
env:
ANDROID_HOME:
PLATFORM_ENV: native
NUXT_PUBLIC_SITE_URL: ${{ vars.SITE_URL }}
strategy:
fail-fast: false
matrix:
include:
- platform: 'ubuntu-latest'
os: 'android'
# - platform: 'ubuntu-latest'
# name: 'ios'
# args: ''
runs-on: ${{ matrix.platform }}
steps:
- name: 📥 Checkout Repo
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Install OS Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Setup Java
uses: actions/setup-java@v6
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v4
- name: Setup Android NDK
run: |
sdkmanager "ndk;29.0.13846066"
echo "NDK_HOME=${{ env.ANDROID_HOME }}/ndk/29.0.13846066" >> $GITHUB_ENV
- name: Setup Android Signing
run: |
cd src-tauri/gen/android
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" > keystore.properties
echo "password=${{ secrets.ANDROID_KEY_PASSWORD }}" >> keystore.properties
base64 -d <<< "${{ secrets.ANDROID_KEY_BASE64 }}" > ./release-keystore.jks
echo "storeFile=../release-keystore.jks" >> keystore.properties
- name: 🛠️ Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android
- name: 🛠️ Setup Node
uses: actions/setup-node@v7
with:
node-version: 'lts/*'
- name: 🛠️ Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: 📦 Install Dependencies
run: bun install --frozen-lockfile
- name: ⚙️ Build Artifact
run: bun run tauri:build:mobile
- name: ⚙️ Upload Artifact
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk
asset_name: nuxtemplate_${{ env.VERSION }}_arm64.apk
tag: ${{ env.VERSION }}
- name: ⚙️ Upload Artifact
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: src-tauri/gen/android/app/build/outputs/bundle/universalRelease/app-universal-release.aab
asset_name: nuxtemplate_${{ env.VERSION }}_arm64.aab
tag: ${{ env.VERSION }}
# deploy-mobile:
# needs: build-mobile
# runs-on: ubuntu-latest