-
-
Notifications
You must be signed in to change notification settings - Fork 103
139 lines (117 loc) · 4.63 KB
/
compile-and-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
131
132
133
134
135
136
137
138
139
name: Build and Draft Release
# Only runs
# - after PRs have been merged into master
# - when a user specifically requests the workflow to run on a branch
on:
workflow_dispatch:
push:
branches: master
jobs:
checkversion:
name: Check if version has corrosponding tag
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
commits: ${{ steps.commits.outputs.commits }}
template: ${{ steps.template.outputs.template }}
dobuild: ${{ steps.dobuild.outputs.dobuild }}
steps:
- name: Checkout crowbartools/firebot
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Read package.json
id: package
uses: gregoranders/[email protected]
- name: Retrieve package.json version
id: version
run: echo "version=${{ steps.package.outputs.version }}" >> $GITHUB_OUTPUT
- name: Get commit messages
id: commits
shell: bash
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
RES=$(git log --pretty=format:'- %s' --branches=origin/v5 $(git describe --tags `git rev-list --tags --max-count=1`)..HEAD)
echo "commits<<${EOF}" >> $GITHUB_OUTPUT
echo "${RES}" >> $GITHUB_OUTPUT
echo "${EOF}" >> $GITHUB_OUTPUT
- name: Read Release Template
id: template
shell: bash
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
TEMPLATE=`cat './.github/release-template.md'`
echo "template<<${EOF}" >> $GITHUB_OUTPUT
echo "${TEMPLATE}" >> $GITHUB_OUTPUT
echo "${EOF}" >> $GITHUB_OUTPUT
- name: 'Check: package version has corrosponding git tag'
id: dobuild
shell: bash
run: echo dobuild=$(git show-ref --tags --verify --quiet -- "refs/tags/v${{ steps.version.outputs.version }}" && echo 0 || echo 1) >> $GITHUB_OUTPUT
compile:
name: 'Compile'
needs: [checkversion]
if: needs.checkversion.outputs.dobuild == 1
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: '20.14.0'
- name: Install correct npm version
run: npm install -g [email protected]
- name: Linux Build Prep
if: runner.os == 'linux'
run: sudo apt-get install libx11-dev libxtst-dev libpng-dev
- name: MacOS Build Prep
if: runner.os == 'macOS'
# Force install this dep until node-appdmg then electron-installer-dmg gets updated
run: npm install github:SReject/electron-installer-dmg#9bdb5217b078c724918271549f34d362aecbf6bb
- name: Install Global Dependencies
run: npm install --global --production --omit=dev grunt-cli
- name: Install Project Dependencies
run: npm install
- name: Decrypt Secrets.gpg
env:
PASSKEY_FOR_FIREBOT_SECRETS: ${{ secrets.PASSKEY_FOR_FIREBOT_SECRETS }}
run: grunt secrets:decrypt
- name: Build for Platform
run: grunt build
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}
path: ./dist/install/${{ runner.os == 'macOS' && 'darwin' || runner.os }}/
draft:
name: Draft Github Release
needs: [checkversion, compile]
if: needs.checkversion.outputs.dobuild == 1
runs-on: ubuntu-latest
steps:
- name: Download Compilation Artifacts
uses: actions/download-artifact@v3
with:
path: ./bundles/
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
token: ${{ env.GITHUB_TOKEN }}
draft: true
prerelease: false
tag_name: v${{ needs.checkversion.outputs.version }}
name: Release v${{ needs.checkversion.outputs.version }}
body: ${{ format(needs.checkversion.outputs.template, needs.checkversion.outputs.version, needs.checkversion.outputs.commits) }}
generate_release_notes: false
files: |
./bundles/Windows/firebot-v${{ needs.checkversion.outputs.version }}-setup.exe
./bundles/Windows/firebot-${{ needs.checkversion.outputs.version }}-full.nupkg
./bundles/Windows/RELEASES
./bundles/Linux/firebot-v${{ needs.checkversion.outputs.version }}-linux-x64.tar.gz
./bundles/macOS/firebot-v${{ needs.checkversion.outputs.version }}-macos-x64.dmg