-
Notifications
You must be signed in to change notification settings - Fork 3
167 lines (159 loc) · 5.69 KB
/
release.yaml
File metadata and controls
167 lines (159 loc) · 5.69 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
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
165
166
167
name: Build
on:
push:
branches:
- master
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
release-please:
name: Release Please # https://github.com/googleapis/release-please
runs-on: ubuntu-22.04
outputs:
release_created: ${{ steps.release.outputs.release_created }}
upload_url: ${{ steps.release.outputs.upload_url }}
tag_name: ${{ steps.release.outputs.tag_name }}
major: ${{ steps.release.outputs.major }}
minor: ${{ steps.release.outputs.minor }}
patch: ${{ steps.release.outputs.patch }}
steps:
- name: Release Please
uses: google-github-actions/release-please-action@v3.6.1
id: release
with:
release-type: rust
package-name: release-please-action
extra-files: |
README.md
release-binaries:
name: Release ${{ matrix.target }}
needs:
- release-please
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
- target: x86_64-apple-darwin
os: macos-11
- target: aarch64-apple-darwin
os: macos-11
- target: x86_64-pc-windows-msvc
os: windows-2022
steps:
- uses: actions/checkout@v3.1.0
- uses: actions-rs/toolchain@v1.0.6
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2.2.0
with:
sharedKey: shared-cache
- uses: actions-rs/cargo@v1.0.1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.target }}
- shell: bash
env:
TAG_NAME: "${{ needs.release-please.outputs.tag_name }}"
run: |
archive_name="helm-templexer-${TAG_NAME#v}-${{ matrix.target }}.tar.gz"
cd target/${{ matrix.target }}/release
tar czvf ../../../"${archive_name}" helm-templexer*
cd -
openssl dgst -sha256 -r "${archive_name}" \
| awk '{print $1}' > "${archive_name}.sha256"
- uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.release-please.outputs.upload_url }}
asset_path: ./helm-templexer-${{ needs.release-please.outputs.major }}.${{ needs.release-please.outputs.minor }}.${{ needs.release-please.outputs.patch }}-${{ matrix.target }}.tar.gz
asset_name: helm-templexer-${{ needs.release-please.outputs.major }}.${{ needs.release-please.outputs.minor }}.${{ needs.release-please.outputs.patch }}-${{ matrix.target }}.tar.gz
asset_content_type: application/gzip
- uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.release-please.outputs.upload_url }}
asset_path: ./helm-templexer-${{ needs.release-please.outputs.major }}.${{ needs.release-please.outputs.minor }}.${{ needs.release-please.outputs.patch }}-${{ matrix.target }}.tar.gz.sha256
asset_name: helm-templexer-${{ needs.release-please.outputs.major }}.${{ needs.release-please.outputs.minor }}.${{ needs.release-please.outputs.patch }}-${{ matrix.target }}.tar.gz.sha256
asset_content_type: application/gzip
publish-cratesio:
name: Publish to crates.io
needs:
- release-please
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3.1.0
- uses: actions-rs/toolchain@v1.0.6
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2.2.0
with:
sharedKey: shared-cache
- uses: katyo/publish-crates@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
containerize:
name: Build & push container image
needs:
- release-please
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3.1.0
- uses: actions-rs/toolchain@v1.0.6
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2.2.0
with:
sharedKey: shared-cache
- name: Build binary
uses: actions-rs/cargo@v1.0.1
with:
command: build
args: --release --target x86_64-unknown-linux-musl
use-cross: true
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to the Container registry
uses: docker/login-action@v2.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4.1.1
with:
images: |
${{ env.IMAGE_NAME }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v3.2.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}