Skip to content

added build:release job to workflow #54

added build:release job to workflow

added build:release job to workflow #54

Workflow file for this run

name: Release
permissions:
"contents": "write"
on:
pull_request:
push:
tags:
- "**[0-9]+.[0-9]+.[0-9]+*"
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Check version numbers match
run: |
card_ver=v$(cargo metadata --format-version=1 --no-deps | jq '.packages[0].version' | tr -d '"')
if [[ $card_ver != "${{ github.ref_name }}" ]]; then exit 1; fi
build:
needs: [checks]
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
ext: tgz
compress_cmd: tar -czf cardamon-x86_64-unknown-linux-gnu-${{ github.ref_name }}.tgz -C artifact .
- os: windows-latest
target: x86_64-pc-windows-msvc
ext: zip
compress_cmd: Compress-Archive -Path artifact/* -Destination cardamon-x86_64-pc-windows-msvc-${{ github.ref_name }}.zip
runs-on: ${{ matrix.os }}
steps:
- name: Checkout cardamon
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: "20.x"
- name: Install NodeJS dependencies
run: npm --prefix ui install
- name: Build UI
run: npm --prefix ui run build:release
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build Cardamon
run: cargo build --release
- name: Build release artifact
run: |
mkdir artifact
cp target/release/cardamon artifact/cardamon
cp LICENSE artifact/
cp README.md artifact/
- name: Compress build artifact
run: ${{ matrix.compress_cmd }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: cardamon-${{ matrix.target }}-${{ github.ref_name }}.${{ matrix.ext }}
publish_crate:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout cardamon
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: "20.x"
- name: Install NodeJS dependencies
run: npm --prefix ui install
- name: Build UI
run: npm --prefix ui run build:release
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build Cardamon
run: cargo publish --no-verify --allow-dirty --token ${{ secrets.CRATES_IO_TOKEN }}
release:
needs: [build]
# needs: [publish_crate]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifact
merge-multiple: true
- name: Create release
run: gh release create ${{ github.ref_name }} --draft --title "Release ${{ github.ref_name }}" --notes "" artifact/cardamon-x86_64-unknown-linux-gnu-${{ github.ref_name }}.tgz artifact/cardamon-x86_64-pc-windows-msvc-${{ github.ref_name }}.zip
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}