-
Notifications
You must be signed in to change notification settings - Fork 1
152 lines (121 loc) · 3.98 KB
/
publish_version.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
140
141
142
143
144
145
146
147
148
149
150
151
152
name: publish_version
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
publish_rock_and_build_ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install Lua
uses: leafo/gh-actions-lua@v10
- name: Install LuaRocks
uses: leafo/gh-actions-luarocks@v4
- run: luarocks install dkjson
- name: Install dependencies
run: npm ci
- name: Create .env file
run: |
touch .env
echo LUAROCKS_API_KEY=${{ secrets.LUAROCKS_API_KEY }} >> .env
- name: Publish the rock
run: npm run ci:publish
- name: Install Luvit
run: curl -L https://github.com/luvit/lit/raw/master/get-lit.sh | sh
- name: Make lit and luvit available and executable
run: |
sudo cp lit /usr/local/bin/lit
sudo chmod +x /usr/local/bin/lit
sudo cp luvit /usr/local/bin/luvit
sudo chmod +x /usr/local/bin/luvit
sudo cp luvi /usr/local/bin/luvi
sudo chmod +x /usr/local/bin/luvi
- name: Build the Lit binary
run: npm run build:lit
- name: Rename the Lit binary
run: mv ./dist/jestronaut ./dist/jestronaut-ubuntu
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: jestronaut-ubuntu
path: dist/jestronaut-ubuntu
build_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install Luvit
shell: pwsh
run: "[Net.ServicePointManager]::SecurityProtocol = 'Tls12'; iex ((new-object net.webclient).DownloadString('https://github.com/luvit/lit/raw/master/get-lit.ps1'))"
- name: Install dependencies
run: npm ci
- name: Build the Lit binary
run: npm run build:lit
- name: Rename the Lit binary
run: mv ./dist/jestronaut.exe ./dist/jestronaut-windows.exe
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: jestronaut-windows.exe
path: dist/jestronaut-windows.exe
build_gmod_addon:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Build the GMod addon
run: npm run build:gmod
- name: Upload GMod addon artifact
uses: actions/upload-artifact@v4
with:
name: gmod-addon.zip
path: dist/gmod-addon.zip
publish_github:
runs-on: ubuntu-latest
needs: [publish_rock_and_build_ubuntu, build_windows]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Create dist directory
run: mkdir -p dist
- name: Download artifacts from publish_rock_and_build_ubuntu, build_windows, and build_gmod_addon
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Store the latest tag in a variable
id: get_tag
run: |
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "LATEST_TAG=$latest_tag" >> $GITHUB_ENV
echo "Latest tag is $LATEST_TAG"
- name: Fail if no tag is found
run: |
if [ -z "$LATEST_TAG" ]; then
echo "Failed: No latest tag found"
exit 1
fi
- name: Create a new release
id: create_release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LATEST_TAG: ${{ steps.get_tag.outputs.LATEST_TAG }}
run: |
gh release create $LATEST_TAG \
--prerelease \
--title "Latest (automatic build)" \
dist/jestronaut-ubuntu \
dist/jestronaut-windows.exe \
dist/gmod-addon.zip