publish_version #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
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 | |
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 | |
- name: Install GitHub CLI | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gh | |
- name: Authenticate GitHub CLI | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token | |
- name: Create a new release | |
id: create_release | |
run: | | |
gh release create latest \ | |
--prerelease \ | |
--title "Latest (automatic build)" \ | |
dist/jestronaut-ubuntu \ | |
dist/jestronaut-windows.exe \ | |
dist/gmod-addon.zip |