Xodium CI/CD #81
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: Xodium CI/CD | |
run-name: "Xodium CI/CD" | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
packages: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ github.ref_name }} | |
url: ${{ steps.upload_artifact.outputs.artifact-url }} | |
outputs: | |
VERSION: ${{ steps.get_version.outputs.VERSION }} | |
steps: | |
- id: checkout | |
name: Checkout | |
uses: actions/checkout@main | |
- id: setup_rust | |
name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- id: build_artifact | |
name: Build Artifact | |
run: cargo build --target=x86_64-pc-windows-gnu --release | |
- id: install_toml_cli | |
name: Install toml-cli | |
run: cargo install toml-cli | |
- id: get_version | |
name: Get Version | |
run: echo "VERSION=$(toml get xcad/Cargo.toml package.version)" >> $GITHUB_OUTPUT | |
- id: upload_artifact | |
name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact | |
path: target/x86_64-pc-windows-gnu/release/xcad | |
test: | |
needs: [build] | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ github.ref_name }} | |
steps: | |
- id: download_artifact | |
name: Download Artifact | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
name: artifact | |
- id: setup_rust | |
name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- id: run_tests | |
name: Run Tests | |
run: cargo test --all | |
release: | |
needs: [build, test] | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ github.ref_name }} | |
url: ${{ steps.create_release.outputs.url }} | |
steps: | |
- id: download_artifact | |
name: Download Artifact | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
name: artifact | |
- id: create_release | |
name: Create Release | |
uses: softprops/action-gh-release@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
draft: ${{ contains(github.event.head_commit.message, '.draft') }} | |
generate_release_notes: true | |
prerelease: ${{ contains(github.event.head_commit.message, '.pre') }} | |
tag_name: ${{ needs.build.outputs.VERSION }} |