-
Notifications
You must be signed in to change notification settings - Fork 10
144 lines (132 loc) · 3.93 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
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-latest
rust_target: x86_64-apple-darwin
ext: ""
args: ""
- os: macos-14 # beta (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 --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@v3
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
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
docker:
runs-on: ubuntu-latest
environment: docker
needs:
- info
steps:
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
push: true
tags: 1915keke/commitlint-rs:${{ needs.info.outputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
info:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.info.outputs.tag }}
steps:
- id: info
run: echo tag=$(echo $GITHUB_REF | cut -d / -f 3 | sed -e 's/v//') >> $GITHUB_OUTPUT
publish:
runs-on: ubuntu-latest
needs:
- build
- crate
- docker
- 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
generateReleaseNotes: true
web:
runs-on: ubuntu-latest
environment:
name: web
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: withastro/action@v0
with:
path: ./web
- id: deployment
uses: actions/deploy-pages@v2