-
-
Notifications
You must be signed in to change notification settings - Fork 3
126 lines (105 loc) · 3.28 KB
/
build.yml
File metadata and controls
126 lines (105 loc) · 3.28 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
name: Build
on:
workflow_dispatch:
inputs:
node_version:
description: "Node.js Version"
required: false
default: "20.18.1"
electron_version:
description: "Electron Version"
required: false
default: "32.2.7"
env:
NODE_VERSION: ${{ inputs.node_version || '20.18.1' }}
ELECTRON_VERSION: ${{ inputs.electron_version || '32.2.7' }}
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
runs-on: ${{ matrix.os }}
steps:
- name: clone repository
uses: actions/checkout@v4
- name: install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: install dependencies
run: npm install
- name: run build script for windows
if: startsWith(matrix.os,'windows')
shell: powershell
run: |
build-windows.ps1
- name: run build script for ubuntu
if: startsWith(matrix.os,'ubuntu')
shell: bash
run: |
chmod +x build-linux.sh
./build-linux.sh
- name: run build script for macOS
if: startsWith(matrix.os,'macOS')
shell: bash
run: |
chmod +x build-macos.sh
./build-macos.sh
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.os }}
path: prebuilds/*
update-version-and-release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Bump Version
id: bump_version
run: |
NEW_VERSION=$(date -u +"%Y%m.%d.%H%M%S")
echo "New version: $NEW_VERSION"
npm version $NEW_VERSION --no-git-tag-version
# Output new version for use in subsequent steps
echo "new_version=$NEW_VERSION" >> $GITHUB_ENV
- name: Commit Updated Version
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"
git add package.json
git commit -m "chore: update version to ${{ env.new_version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push Changes
run: git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: prebuilds
pattern: release-*
merge-multiple: true
- name: Create GitHub Release
uses: actions/create-release@v1
with:
tag_name: "v${{ env.new_version }}"
release_name: "Release v${{ env.new_version }}"
body: |
## Changes
- Automatic version bump to v${{ env.new_version }}.
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to npm
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://registry.npmjs.org/"
- name: Login to npm
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Publish Package
run: npm publish