-
Notifications
You must be signed in to change notification settings - Fork 46
130 lines (108 loc) · 4.1 KB
/
release.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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Exsiting version to publish files. If not provided, will create a new release.'
required: false
type: string
push:
branches:
- master
paths-ignore:
- 'nuxt/**'
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
defaults:
run:
shell: 'bash'
jobs:
release:
runs-on: ubuntu-latest
outputs:
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
steps:
- uses: actions/checkout@v4
# https://github.com/nodejs/node-gyp/issues/2869
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'yarn'
- name: Install semantic-release dependencies
run: yarn add -D @semantic-release/commit-analyzer conventional-changelog-eslint
- uses: cycjimmy/semantic-release-action@cb425203a562475bca039ba4dbf90c7f9ac790f4
id: semantic
if: inputs.version == ''
with:
semantic_version: 24.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
needs: [release]
if: needs.release.outputs.new_release_published == 'true' || inputs.version != ''
env:
NEW_RELEASE_PUBLISHED: ${{ inputs.version && 'true' || needs.release.outputs.new_release_published }}
NEW_RELEASE_VERSION: ${{ needs.release.outputs.new_release_version || inputs.version }}
NODE_ENV: production
MODE: production
VITE_GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
VITE_GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
VITE_SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY }}
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
permissions:
contents: write # Allows this job to create releases
strategy:
fail-fast: false
matrix:
os:
- macos-13
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'yarn'
node-version-file: '.node-version'
- name: Install dependencies
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get update && sudo apt-get install -y libopenjp2-tools
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@d33c176a9b784876d966f80fb1b461808edc0641
# Only install Snapcraft on Ubuntu
if: startsWith(matrix.os, 'ubuntu')
continue-on-error: true
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
- name: set version
run: yarn version --no-git-tag-version --new-version ${{ env.NEW_RELEASE_VERSION }}
- run: yarn
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
NODE_ENV: development
- run: yarn build
- name: Compile artifacts ${{ env.NEW_RELEASE_PUBLISHED == 'true' && 'and upload them to github release' || '' }}
# I use this action because it is capable of retrying multiple times if there are any issues with the distribution server
uses: nick-fields/retry@v3
with:
timeout_minutes: 15
max_attempts: 6
retry_wait_seconds: 15
retry_on: error
shell: 'bash'
# Due to this issue https://github.com/electron-userland/electron-builder/issues/6411 the build with npx when rebuilding native dependencies hangs forever
# see https://github.com/cawa-93/vite-electron-builder/pull/953
command: ./node_modules/.bin/electron-builder --config electron-builder.yml --publish $PUBLISH_PARAM
env:
# Code Signing params
# See https://www.electron.build/code-signing
# CSC_LINK: ''
# CSC_KEY_PASSWORD: ''
# Publishing artifacts
GH_TOKEN: ${{ secrets.github_token }}
PUBLISH_PARAM: ${{ env.NEW_RELEASE_PUBLISHED == 'true' && 'always' || 'never' }}