2024-09-09 17:08:24 +02:00
|
|
|
name: lua
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2024-11-17 14:33:57 +01:00
|
|
|
tags:
|
|
|
|
- 'v*.*.*'
|
2024-09-09 17:08:24 +02:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
jobs:
|
2024-09-09 19:47:42 +02:00
|
|
|
build:
|
2024-09-09 17:08:24 +02:00
|
|
|
runs-on: ${{ matrix.platform.runner }}
|
|
|
|
strategy:
|
2024-09-09 19:52:32 +02:00
|
|
|
fail-fast: false
|
2024-09-09 17:08:24 +02:00
|
|
|
matrix:
|
2024-09-10 16:09:56 +02:00
|
|
|
platform:
|
2024-09-09 17:08:24 +02:00
|
|
|
- runner: ubuntu-latest
|
2024-09-10 16:02:54 +02:00
|
|
|
arch: x86_64
|
2024-09-10 16:09:56 +02:00
|
|
|
target: linux-gnu
|
2024-09-10 02:39:55 +02:00
|
|
|
pre: lib
|
2024-09-10 16:02:54 +02:00
|
|
|
ext: so
|
2024-09-09 17:08:24 +02:00
|
|
|
- runner: windows-latest
|
2024-09-10 16:02:54 +02:00
|
|
|
arch: x86_64
|
2024-09-10 16:15:31 +02:00
|
|
|
target: windows-msvc
|
2024-09-10 02:39:55 +02:00
|
|
|
pre:
|
2024-09-10 16:02:54 +02:00
|
|
|
ext: dll
|
2024-09-10 03:45:38 +02:00
|
|
|
- runner: macos-latest
|
2024-09-10 16:02:54 +02:00
|
|
|
arch: aarch64
|
2024-09-10 16:09:56 +02:00
|
|
|
target: darwin
|
2024-09-10 15:42:20 +02:00
|
|
|
pre: lib
|
2024-09-10 16:02:54 +02:00
|
|
|
ext: dylib
|
2024-09-10 03:39:01 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-09-21 12:11:55 +02:00
|
|
|
with:
|
|
|
|
fetch-depth: 0 # necessary to get last tag
|
2024-09-10 03:39:01 +02:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- uses: arduino/setup-protoc@v3
|
2024-09-10 14:51:58 +02:00
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
2024-11-17 14:33:32 +01:00
|
|
|
- run: cargo build --release --features=lua
|
2024-09-21 12:03:23 +02:00
|
|
|
- id: previoustag
|
|
|
|
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
|
|
|
with:
|
|
|
|
fallback: v0.0.0
|
|
|
|
- run: mv target/release/${{matrix.platform.pre}}codemp.${{matrix.platform.ext}} dist/lua/codemp-lua-${{steps.previoustag.outputs.tag}}-${{matrix.platform.arch}}-${{matrix.platform.target}}.${{matrix.platform.ext}}
|
2024-09-10 03:39:01 +02:00
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: codemp-lua-${{ matrix.platform.target }}
|
2024-09-21 12:03:23 +02:00
|
|
|
path: dist/lua/codemp-lua-*
|
2024-09-10 02:06:57 +02:00
|
|
|
|
|
|
|
publish:
|
2024-09-21 12:03:23 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [build]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- uses: arduino/setup-protoc@v3
|
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- uses: leafo/gh-actions-lua@v9
|
|
|
|
- uses: leafo/gh-actions-luarocks@v4
|
2024-09-21 12:36:24 +02:00
|
|
|
- run: luarocks install --local dkjson # needed to run upload?? ooook luarocks...
|
2024-09-21 12:17:48 +02:00
|
|
|
- run: luarocks upload codemp-*.rockspec --api-key ${{ secrets.LUAROCKS_TOKEN }}
|
2024-09-21 12:03:23 +02:00
|
|
|
working-directory: dist/lua
|
|
|
|
|
|
|
|
upload:
|
2024-09-10 02:06:57 +02:00
|
|
|
runs-on: ubuntu-latest
|
2024-09-17 20:28:59 +02:00
|
|
|
needs: [build]
|
2024-09-10 02:06:57 +02:00
|
|
|
steps:
|
2024-09-10 16:14:35 +02:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- run: mkdir dist/lua/publish
|
2024-09-10 02:06:57 +02:00
|
|
|
- uses: webfactory/ssh-agent@v0.9.0
|
|
|
|
with:
|
|
|
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
|
|
- uses: actions/download-artifact@v4
|
|
|
|
with:
|
|
|
|
pattern: codemp-lua-*
|
2024-09-10 16:14:35 +02:00
|
|
|
path: dist/lua/publish
|
|
|
|
- run: tree dist/lua
|
|
|
|
- run: scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null dist/lua/annotations.lua dev@codemp.dev:/srv/http/codemp/files/releases/lua/
|
2024-09-10 03:25:23 +02:00
|
|
|
# TODO ugly fix to deal with folders on this side...
|
|
|
|
- name: copy files on remote
|
|
|
|
run: |
|
2024-09-10 16:14:35 +02:00
|
|
|
for DIR in $(ls dist/lua/publish); do
|
|
|
|
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null dist/lua/publish/$DIR/* dev@codemp.dev:/srv/http/codemp/files/releases/lua/
|
2024-09-10 03:25:23 +02:00
|
|
|
done
|