Skip to content

Commit

Permalink
CI/CD to release nightly version to GH release
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Nov 5, 2024
1 parent 6034581 commit a3a2dcd
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 3 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Nightly

on:
workflow_dispatch:
schedule:
- cron: "0 23 * * *"

permissions:
contents: write

jobs:
build-and-upload:
name: Build and upload
runs-on: ${{ matrix.os }}

strategy:
matrix:
# You can add more, for any target you'd like!
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu

- build: macos-amd
os: macos-latest
target: x86_64-apple-darwin

- build: macos-amd
os: macos-latest
target: aarch64-apple-darwin

- build: windows-gnu
os: windows-latest
target: x86_64-pc-windows-msvc

steps:
- uses: actions/checkout@v4

- name: Get the release version from the tag
run: echo "VERSION=nightly-$(date +'%Y-%m-%d')-${{ github.sha }}" >> $GITHUB_ENV
shell: bash

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Setup Cache
uses: Swatinem/rust-cache@v2

- name: Build Binary
run: cargo build --verbose --locked --release --target ${{ matrix.target }}

- name: Build archive
shell: bash
run: |
binary_names=("tatzelwurm" "workwurm" "actionwurm")
dirname="${binary_names[0]}-${{ env.VERSION }}-${{ matrix.target }}"
mkdir "$dirname"
# Move each binary to the directory
for binary_name in "${binary_names[@]}"; do
if [ "${{ matrix.os }}" = "windows-latest" ]; then
mv "target/${{ matrix.target }}/release/$binary_name.exe" "./${dirname}"
else
mv "target/${{ matrix.target }}/release/$binary_name" "./${dirname}"
fi
done
# Create archive based on OS
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a "$dirname.zip" "$dirname"
echo "ASSET=$dirname.zip" >> $GITHUB_ENV
else
tar -czf "$dirname.tar.gz" "$dirname"
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
fi
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
${{ env.ASSET }}
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ tokio-util = { version = "0.7.12", features = ["codec"] }
uuid = { version = "1.10.0", features = ["fast-rng", "serde", "v4"] }

[[bin]]
name = "coordinator"
name = "tatzelwurm"
path = "src/main.rs"

[[bin]]
name = "worker"
name = "workwurm"
path = "src/bin/worker.rs"

[[bin]]
name = "actioner"
name = "actionwurm"
path = "src/bin/actioner.rs"

0 comments on commit a3a2dcd

Please sign in to comment.