name: Build and upload binaries to release
on:
push:
tags:
- "v[0-9]+.*"
workflow_dispatch:
inputs:
version: description: "Version to deploy"
required: true
jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Set variables
id: vars
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: Release ${{ steps.vars.outputs.tag }}
draft: false
prerelease: false
body: |
This is a new release of lumesh. [Read the changelog here](https://codeberg.com/santo/lumesh/blob/${{ steps.vars.outputs.tag }}/CHANGELOG.md).
- lume: an edition contains interactive repl and script parser.
- lume-se: an swift edition only contains script parser. used to run script swiftly.
- doc: help docs.
If you're running on Linux, macOS or Windows, you can probably use one of the binaries below.
build_docs:
name: Build documentation
needs: create_release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Generate docs
run: |
mkdir -p tmp/doc
cp CHANGELOG.md tmp/doc/
cp README.md tmp/doc/
cp LICENSE tmp/doc/
cp docs/INS_README.md tmp/doc/
cp docs/RULE.md tmp/doc/
cp docs/install.sh tmp/install.sh
- name: Create compressed files
run: |
tar -czf data.tgz -C docs/data lumesh
tar -czvf doc.tgz -C tmp doc
- name: Upload docs and install scripts
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
data.tgz
doc.tgz
release_assets:
name: Release assets
needs: [create_release]
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux
file_ending: ""
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
platform: linux-musl
file_ending: ""
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
platform: linux-arm64
file_ending: ""
target: aarch64-unknown-linux-gnu
- os: ubuntu-latest
platform: linux-arm64-musl
file_ending: ""
target: aarch64-unknown-linux-musl
- os: macos-latest
platform: macos
file_ending: ""
target: x86_64-apple-darwin
- os: macos-latest
platform: macos-arm64
file_ending: ""
target: aarch64-apple-darwin
- os: windows-latest
platform: windows
file_ending: ".exe"
target: x86_64-pc-windows-gnu
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Add Rust target
run: rustup target add ${{ matrix.target }}
- name: Build on Unix platforms
if: runner.os != 'Windows'
run: |
if [[ "${{ runner.os }}" == "macOS" ]]; then
cargo build --release --target ${{ matrix.target }}
cargo build --features runner --release --target ${{ matrix.target }}
elif [[ "${{ matrix.target }}" == x86_64-unknown-linux-gnu ]]; then
cargo build --release --target ${{ matrix.target }}
cargo build --features runner --release --target ${{ matrix.target }}
else
cargo install cross
cross build --release --target ${{ matrix.target }}
cross build --features runner --release --target ${{ matrix.target }}
fi
shell: bash
- name: Build on Windows
if: runner.os == 'Windows'
run: |
cargo build --release --target ${{ matrix.target }}
cargo build --features runner --release --target ${{ matrix.target }}
- name: Upload main binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_name: lume_${{ matrix.platform }}${{ matrix.file_ending }}
asset_path: target/${{ matrix.target }}/release/lume${{ matrix.file_ending }}
asset_content_type: application/octet-stream
- name: Upload runner binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_name: lume-se_${{ matrix.platform }}${{ matrix.file_ending }}
asset_path: target/${{ matrix.target }}/release/lume-se${{ matrix.file_ending }}
asset_content_type: application/octet-stream