-
Notifications
You must be signed in to change notification settings - Fork 4
135 lines (108 loc) · 2.98 KB
/
build_and_publish.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
name: build and publish
on:
push:
branches:
- trunk
tags:
- '*'
jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: nightly
override: true
profile: minimal
components: rustfmt
- uses: actions-rs/cargo@v1.0.3
name: cargo fmt
with:
command: fmt
args: -- --check
debug_build_and_checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
profile: minimal
components: clippy
- uses: actions-rs/cargo@v1.0.3
name: cargo build
with:
command: build
- uses: actions-rs/cargo@v1.0.3
name: cargo test
with:
command: test
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
release_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
profile: minimal
- uses: actions-rs/cargo@v1.0.3
name: cargo build
with:
command: build
args: --release
- uses: actions-rs/cargo@v1.0.3
name: cargo publish --dry-run
with:
command: publish
args: --dry-run
publish:
runs-on: ubuntu-latest
needs:
- rustfmt
- debug_build_and_checks
- release_build
steps:
- uses: actions/checkout@v4
- uses: crazy-max/ghaction-docker-meta@v1
id: docker_meta
with:
images: |
jakewharton/uniqtoo
ghcr.io/jakewharton/uniqtoo
tag-semver: |
{{version}}
{{major}}
{{major}}.{{minor}}
- uses: docker/login-action@v3
with:
username: jakewharton
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- run: echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
profile: minimal
- uses: actions-rs/cargo@v1.0.3
if: startsWith(github.ref, 'refs/tags/')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
with:
command: publish
- uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
- uses: ffurrer2/extract-release-notes@v2
if: startsWith(github.ref, 'refs/tags/')
id: release_notes
- uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
body: ${{ steps.release_notes.outputs.release_notes }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}