-
-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (81 loc) · 2.41 KB
/
ci_cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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
if: github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '.deploy')
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: run_tests
# name: Run Tests
# run: python -m unittest discover
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 }}