build #225
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
schedule: | |
- cron: '0 0 * * 0' | |
workflow_dispatch: | |
inputs: | |
tag_name: | |
description: 'Tag name for release' | |
required: false | |
default: nightly | |
push: | |
tags: ["v[0-9]+.[0-9]+.[0-9]+*"] | |
release: | |
types: [published] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CARGO_TERM_COLOR: always | |
REGISTRY: ghcr.io | |
RUST_VERSION: 1.63.0 | |
jobs: | |
linux: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ env.RUST_VERSION }} | |
- name: Init cache | |
uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab | |
- name: Setup Mold | |
uses: rui314/setup-mold@v1 | |
with: | |
mold-version: 1.4.1 | |
make-default: false | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install build-essential | |
- name: Build | |
run: cargo build --release | |
- name: Gzip | |
run: | | |
mkdir buklo | |
cp ./target/release/buklo buklo/ | |
tar -zcvf ./buklo-linux.tar.gz buklo | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: buklo-linux | |
path: | | |
./buklo-linux.tar.gz | |
retention-days: 1 | |
publish: | |
needs: [linux] | |
runs-on: ubuntu-24.04 | |
env: | |
GH_REPO: ${{ github.repository }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
- if: github.event_name == 'workflow_dispatch' | |
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV | |
- if: github.event_name == 'schedule' | |
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV | |
- if: github.event_name == 'push' | |
run: | | |
TAG_NAME=${{ github.ref }} | |
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV | |
- if: env.TAG_NAME == 'nightly' | |
run: | | |
(echo 'SUBJECT=buklo development build'; | |
echo 'PRERELEASE=--prerelease') >> $GITHUB_ENV | |
gh release delete nightly --yes || true | |
git push origin :nightly || true | |
- if: env.TAG_NAME != 'nightly' | |
run: | | |
(echo 'SUBJECT=buklo release build'; | |
echo 'PRERELEASE=') >> $GITHUB_ENV | |
- name: Publish release | |
run: | | |
gh release create $TAG_NAME $PRERELEASE --title "$TAG_NAME" --target $GITHUB_SHA buklo-linux/* |