-
Notifications
You must be signed in to change notification settings - Fork 10
164 lines (148 loc) · 4.48 KB
/
release.yaml
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
permissions:
contents: write # To write to release
id-token: write # To deploy to GitHub Pages
pages: write # To deploy to GitHub Pages
jobs:
build:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: true
matrix:
config:
# See details fore GitHub Actions runners
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners
- os: ubuntu-20.04
rust_target: x86_64-unknown-linux-gnu
ext: ""
args: ""
- os: macos-13 # (Intel x86)
rust_target: x86_64-apple-darwin
ext: ""
args: ""
- os: macos-latest # (Apple Silicon)
rust_target: aarch64-apple-darwin
ext: ""
args: ""
- os: windows-latest
rust_target: x86_64-pc-windows-msvc
ext: ".exe"
args: ""
- os: windows-latest
rust_target: aarch64-pc-windows-msvc
ext: ".exe"
args: "--no-default-features --features native-tls-vendored"
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: cargo build --package commitlint-rs --release
- run: tar czvf commitlint-${{ github.ref_name }}-${{ matrix.config.rust_target }}.tar.gz -C target/release commitlint${{ matrix.config.ext }}
- uses: actions/upload-artifact@v4
with:
name: commitlint-${{ matrix.config.rust_target }}
path: commitlint-${{ github.ref_name }}-${{ matrix.config.rust_target }}.tar.gz
if-no-files-found: error
crate:
runs-on: ubuntu-latest
environment: crate
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- run: cargo publish --package commitlint-rs
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
docker:
runs-on: ubuntu-latest
environment: docker
steps:
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: 1915keke/commitlint
tags: |
type=raw,value=latest
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
publish:
runs-on: ubuntu-latest
needs:
- build
- crate
- docker
- schema
- web
steps:
- uses: actions/download-artifact@v4
with:
path: commitlint
pattern: commitlint-*
merge-multiple: true
- uses: ncipollo/release-action@v1
with:
artifacts: commitlint/commitlint-*.tar.gz,schema.json
generateReleaseNotes: true
schema:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: cargo run --package schema -- --path schema.json
- uses: actions/upload-artifact@v4
with:
name: schema.json
path: schema.json
if-no-files-found: error
web:
runs-on: ubuntu-latest
environment:
name: web
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: withastro/action@v2
with:
path: ./web
- id: deployment
uses: actions/deploy-pages@v4