-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (109 loc) · 3.29 KB
/
Copy pathrelease-cli.yml
File metadata and controls
115 lines (109 loc) · 3.29 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: release-cli
on:
push:
tags:
- 'cli/*'
env:
CARGO_TERM_COLOR: always
jobs:
check:
if: startsWith(github.ref, 'refs/tags/cli/')
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/cli
outputs:
version: ${{ steps.version.outputs.value }}
steps:
- uses: actions/checkout@v5
- name: extract version from tag
id: version
run: echo "value=${GITHUB_REF_NAME#cli/}" >> $GITHUB_OUTPUT
- name: validate version
run: ./scripts/validate-version.sh "${{ github.ref_name }}"
- name: validate changelog
run: |
VERSION="${{ steps.version.outputs.value }}"
./scripts/validate-changelog.sh "${VERSION#v}"
build-binaries:
needs: check
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
ext: ""
- os: macos-latest
target: aarch64-apple-darwin
ext: ""
- os: windows-latest
target: x86_64-pc-windows-msvc
ext: ".exe"
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: src/cli
steps:
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
- name: build binary
run: cargo build --release --target ${{ matrix.target }}
- name: upload binary
uses: actions/upload-artifact@v5
with:
name: qtcloud-devops-${{ matrix.target }}
path: ${{ github.workspace }}/src/cli/target/${{ matrix.target }}/release/qtcloud-devops${{ matrix.ext }}
build-package:
needs: check
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/cli
steps:
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: install maturin
run: pip install maturin
- name: build wheel
run: maturin build --release --out dist --auditwheel skip
- name: upload package
uses: actions/upload-artifact@v5
with:
name: dist
path: ${{ github.workspace }}/src/cli/dist/*
publish-crate:
needs: [build-binaries, build-package]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: publish to crates.io
working-directory: src/cli
run: cargo publish --allow-dirty --token ${{ secrets.CRATES_API_TOKEN }}
publish-pypi:
needs: [build-binaries, build-package]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: install uv
run: pip install uv
- name: download package from build
uses: actions/download-artifact@v5
with:
name: dist
path: ${{ github.workspace }}/src/cli/dist
- name: publish to PyPI
working-directory: src/cli
run: uv publish
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}