stopped clash of artifact name #60
Workflow file for this run
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: 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 | |
exe_ext: | |
archive_ext: tgz | |
archive_cmd: tar -czf cardamon-x86_64-unknown-linux-gnu-${{ github.ref_name }}.tgz -C artifact . | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
exe_ext: .exe | |
archive_ext: zip | |
archive_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: Build UI | |
run: cd ui && npm cache clean --force && npm install && npm 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${{ matrix.exe_ext }} artifact/cardamon${{ matrix.exe_ext }} | |
cp LICENSE artifact/ | |
cp README.md artifact/ | |
- name: Compress build artifact | |
run: ${{ matrix.archive_cmd }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cardamon-${{ matrix.os }} | |
path: cardamon-${{ matrix.target }}-${{ github.ref_name }}.${{ matrix.archive_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: Build UI | |
run: cd ui && npm install && npm 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: [publish_crate] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
pattern: cardamon-* | |
merge-multiple: true | |
- name: Create release | |
run: gh release create ${{ github.ref_name }} --draft --title "Release ${{ github.ref_name }}" --notes "" artifacts/cardamon-x86_64-unknown-linux-gnu-${{ github.ref_name }}.tgz artifacts/cardamon-x86_64-pc-windows-msvc-${{ github.ref_name }}.zip | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |