generated from amy-juan-li/electron-vite-react-typescript
-
-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (98 loc) · 3.85 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
name: Release
on: [ workflow_call, workflow_dispatch ]
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: 'bash'
jobs:
draft:
runs-on: ubuntu-latest
outputs:
release-note: ${{ steps.release-note.outputs.release-note }}
version: ${{ steps.version.outputs.build-version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 14
- name: Get last git tag
id: tag
run: echo "::set-output name=last-tag::$(git describe --tags --abbrev=0 || git rev-list --max-parents=0 ${{github.ref}})"
- name: Generate release notes
uses: ./.github/actions/release-notes
id: release-note
with:
from: ${{ steps.tag.outputs.last-tag }}
to: ${{ github.ref }}
include-commit-body: true
include-abbreviated-commit: true
- name: Get version from current date
id: version
run: echo "::set-output name=build-version::$(node -e "try{console.log(require('./.electron-builder.config.js').extraMetadata.version)}catch(e){console.error(e);process.exit(1)}")"
- name: Delete outdated drafts
uses: hugo19941994/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release Draft
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
prerelease: true
draft: true
tag_name: v${{ steps.version.outputs.build-version }}
name: v${{ steps.version.outputs.build-version }}
body: ${{ steps.release-note.outputs.release-note }}
upload_artifacts:
needs: [ draft ]
strategy:
matrix:
os: [ windows-latest ]
# To compile the application for different platforms, use:
# os: [ macos-latest, ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16 # Need for npm >=7.7
cache: 'npm'
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
# The easiest way to transfer release notes to a compiled application is create `release-notes.md` in the build resources.
# See https://github.com/electron-userland/electron-builder/issues/1511#issuecomment-310160119
- name: Prepare release notes
env:
RELEASE_NOTE: ${{ needs.draft.outputs.release-note }}
run: echo "$RELEASE_NOTE" >> ./buildResources/release-notes.md
# Compile app and upload artifacts
- name: Compile & release Electron app
uses: samuelmeuli/action-electron-builder@v1
env:
VITE_APP_VERSION: ${{ needs.draft.outputs.version }}
with:
build_script_name: build
args: --config .electron-builder.config.js
# GitHub token, automatically provided to the action
# (No need to define this secret in the repo settings)
github_token: ${{ secrets.github_token }}
# If the commit is tagged with a version (e.g. "v1.0.0"),
# release the app after building
release: true
# Sometimes the build may fail due to a connection problem with Apple, GitHub, etc. servers.
# This option will restart the build as many attempts as possible
max_attempts: 3
# Code Signing params
# Base64-encoded code signing certificate for Windows
# windows_certs: ''
# Password for decrypting `windows_certs`
# windows_certs_password: ''
# Base64-encoded code signing certificate for macOS
# mac_certs: ''
# Password for decrypting `mac_certs`
# mac_certs_password: ''