Skip to content

Commit

Permalink
Use GH CLI for releasing instead of unmaintained package
Browse files Browse the repository at this point in the history
  • Loading branch information
luttje committed Dec 1, 2024
1 parent 4400625 commit 2188d48
Showing 1 changed file with 41 additions and 9 deletions.
50 changes: 41 additions & 9 deletions .github/workflows/publish_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,33 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
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
Expand All @@ -35,10 +44,13 @@ jobs:
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@v3
with:
Expand All @@ -49,18 +61,24 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
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@v3
with:
Expand All @@ -71,13 +89,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
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@v3
with:
Expand All @@ -91,26 +113,36 @@ jobs:
contents: write
steps:
- uses: actions/checkout@v3

- name: Create dist directory
run: mkdir -p dist

- name: Download binary artifact from publish_rock_and_build_ubuntu
uses: actions/download-artifact@v2
with:
name: jestronaut-ubuntu
path: dist

- name: Download binary artifact from build_windows
uses: actions/download-artifact@v2
with:
name: jestronaut-windows
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
uses: "marvinpinto/[email protected]"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Latest (automatic build)"
files: |
dist/jestronaut-ubuntu
dist/jestronaut-windows.exe
id: create_release
run: |
gh release create latest \
--prerelease \
--title "Latest (automatic build)" \
dist/jestronaut-ubuntu \
dist/jestronaut-windows.exe \
dist/gmod-addon.zip

0 comments on commit 2188d48

Please sign in to comment.