Skip to content

Commit

Permalink
chore: add release workflow ๐Ÿš€
Browse files Browse the repository at this point in the history
  • Loading branch information
latipun7 committed Mar 1, 2023
1 parent 72548cb commit cbbc112
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
4 changes: 4 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>latipun7/library//configs/renovate/default"]
}
101 changes: 101 additions & 0 deletions .github/workflows/gh-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: โš™๏ธ๐Ÿš€

on:
push:
tags: ["*"]

env:
WIN_ARTIFACT: chara-windows-x86_64
LINUX_ARTIFACT: chara-linux-x86_64
LINUX_AARCH_ARTIFACT: chara-linux-aarch64
MACOS_ARTIFACT: chara-macos-x86_64
MACOS_AARCH_ARTIFACT: chara-macos-aarch64

jobs:
build-artifacts:
strategy:
matrix:
include:
- os: windows-latest
artifact-name: ${{ env.WIN_ARTIFACT }}
cargo-target: x86_64-pc-windows-msvc
- os: ubuntu-latest
artifact-name: ${{ env.LINUX_ARTIFACT }}
cargo-target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
artifact-name: ${{ env.LINUX_AARCH_ARTIFACT }}
cargo-target: aarch64-unknown-linux-gnu
linker: gcc-aarch64-linux-gnu
- os: macos-latest
artifact-name: ${{ env.MACOS_ARTIFACT }}
cargo-target: x86_64-apple-darwin
- os: macos-latest
artifact-name: ${{ env.MACOS_AARCH_ARTIFACT }}
cargo-target: aarch64-apple-darwin

name: โš™๏ธ Build (${{ matrix.artifact-name }})
runs-on: ${{ matrix.os }}
steps:
- name: ๐Ÿ›Ž๏ธ Checkout
uses: actions/checkout@v3

- name: โœจ Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: ${{ matrix.cargo-target }}
override: true
profile: minimal

- name: ๐Ÿ”— Install Linker packages
if: ${{ matrix.linker != '' }}
run: |
sudo apt update
sudo apt install ${{ matrix.linker }}
- name: ๐Ÿ› ๏ธ Build Binary
run: cargo build --verbose --locked --release --target ${{ matrix.cargo-target }}

- name: ๐Ÿ“ Setup Archive + Extension
shell: bash
run: |
mkdir -p staging
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp "target/${{ matrix.cargo-target }}/release/chara.exe" staging/
cd staging
7z a ../release.zip *
else
cp "target/${{ matrix.cargo-target }}/release/chara" staging/
cd staging
zip ../release.zip *
fi
- name: โฌ†๏ธ Upload Binary Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact-name }}
path: release.zip
retention-days: 5

create-release:
needs: ["build-artifacts"]
name: ๐Ÿš€ Create Release
runs-on: ubuntu-latest

steps:
- name: โฌ‡๏ธ Download All Binary Artifacts
uses: actions/download-artifact@v3

- name: ๐Ÿ—ƒ๏ธCreate Draft Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
generate_release_notes: true
files: |
${{ env.WIN_ARTIFACT }}.zip
${{ env.LINUX_ARTIFACT }}.zip
${{ env.LINUX_AARCH_ARTIFACT }}.zip
${{ env.MACOS_ARTIFACT }}.zip
${{ env.MACOS_AARCH_ARTIFACT }}.zip

0 comments on commit cbbc112

Please sign in to comment.