2024-02-13 06:05:36 +00:00
|
|
|
name: Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2024-02-23 13:17:33 +00:00
|
|
|
paths:
|
|
|
|
project.toml
|
2024-02-13 06:05:36 +00:00
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
2024-03-16 17:07:12 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
|
2024-02-13 06:05:36 +00:00
|
|
|
jobs:
|
2024-03-16 17:07:12 +00:00
|
|
|
build:
|
|
|
|
name: ${{ matrix.platform.os_name }} with rust ${{ matrix.toolchain }}
|
|
|
|
runs-on: ${{ matrix.platform.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
platform:
|
|
|
|
- os_name: linux-x86_64
|
|
|
|
os: ubuntu-20.04
|
|
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
origin_dylib_suffix: so
|
|
|
|
dest_dylib_suffix: so
|
2024-02-26 06:43:08 +00:00
|
|
|
|
2024-03-16 17:07:12 +00:00
|
|
|
- os_name: mac-x86_64
|
|
|
|
os: macOS-latest
|
|
|
|
target: x86_64-apple-darwin
|
|
|
|
origin_dylib_suffix: dylib
|
|
|
|
dest_dylib_suffix: so
|
2024-02-26 06:43:08 +00:00
|
|
|
|
2024-03-16 17:07:12 +00:00
|
|
|
- os_name: mac-aarch64
|
|
|
|
os: macOS-latest
|
|
|
|
target: aarch64-apple-darwin
|
|
|
|
origin_dylib_suffix: dylib
|
|
|
|
dest_dylib_suffix: so
|
2024-02-26 06:43:08 +00:00
|
|
|
|
2024-03-16 17:07:12 +00:00
|
|
|
toolchain:
|
|
|
|
- stable
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2024-02-26 06:43:08 +00:00
|
|
|
|
2024-03-16 17:07:12 +00:00
|
|
|
- name: Build library
|
|
|
|
uses: houseabsolute/actions-rust-cross@v0
|
|
|
|
with:
|
|
|
|
command: "build"
|
|
|
|
working-directory: ./generator
|
|
|
|
target: ${{ matrix.platform.target }}
|
|
|
|
toolchain: ${{ matrix.toolchain }}
|
|
|
|
args: "--release"
|
|
|
|
|
|
|
|
- name: Rename dynamic lib
|
|
|
|
run: cp generator/target/${{ matrix.platform.target }}/release/libgenerator.${{ matrix.platform.origin_dylib_suffix }} lua/${{ matrix.platform.os_name }}generator.${{ matrix.platform.dest_dylib_suffix }}
|
2024-02-26 06:43:08 +00:00
|
|
|
|
|
|
|
- name: Commit changes
|
2024-03-16 17:07:12 +00:00
|
|
|
uses: EndBug/add-and-commit@v7
|
2024-02-26 06:43:08 +00:00
|
|
|
with:
|
2024-03-16 17:07:12 +00:00
|
|
|
message: '[Update] files based on generated files by template generator'
|
|
|
|
pull_strategy: 'NO-PULL'
|
|
|
|
push: false
|
|
|
|
|
|
|
|
- name: Push changes
|
|
|
|
run: |
|
|
|
|
git pull --rebase
|
|
|
|
git push
|
2024-02-26 06:43:08 +00:00
|
|
|
|
2024-02-13 06:05:36 +00:00
|
|
|
release:
|
|
|
|
runs-on: ubuntu-latest
|
2024-03-16 17:07:12 +00:00
|
|
|
needs: build
|
2024-02-13 06:05:36 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Setup python
|
|
|
|
uses: actions/setup-python@v5
|
|
|
|
with:
|
|
|
|
python-version: "3.11"
|
|
|
|
|
|
|
|
- name: Replace template
|
|
|
|
run: python3 scripts/replace-template.py
|
|
|
|
|
|
|
|
- name: Commit changes
|
2024-03-16 17:55:44 +00:00
|
|
|
uses: EndBug/add-and-commit@v7
|
2024-02-13 06:05:36 +00:00
|
|
|
with:
|
2024-03-16 17:55:44 +00:00
|
|
|
message: '[Update] files based on generated files by template generator'
|
|
|
|
pull_strategy: 'NO-PULL'
|
|
|
|
push: false
|
|
|
|
|
|
|
|
- name: Push changes
|
|
|
|
run: |
|
|
|
|
git pull --rebase
|
|
|
|
git push
|
2024-02-13 06:05:36 +00:00
|
|
|
|
|
|
|
- name: Read version from project config
|
|
|
|
id: read_toml
|
|
|
|
uses: SebRollen/toml-action@v1.0.2
|
|
|
|
with:
|
|
|
|
file: project.toml
|
|
|
|
field: project.version
|
|
|
|
|
|
|
|
- name: Bump version and push tag
|
|
|
|
id: tag_version
|
|
|
|
uses: mathieudutour/github-tag-action@v6.1
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
custom_tag: ${{ steps.read_toml.outputs.value }}
|
|
|
|
|
|
|
|
- name: Create a GitHub release
|
|
|
|
uses: ncipollo/release-action@v1
|
|
|
|
with:
|
|
|
|
tag: ${{ steps.tag_version.outputs.new_tag }}
|
|
|
|
name: Release ${{ steps.tag_version.outputs.new_tag }}
|
|
|
|
generateReleaseNotes: true
|