Skip to content

publish_version

publish_version #21

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: |
git fetch --prune --unshallow --tags
latest_tag=$(git describe --abbrev=0 --tags)
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