-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (95 loc) · 2.88 KB
/
Copy pathrelease.yml
File metadata and controls
100 lines (95 loc) · 2.88 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
name: Release
on:
push:
tags: ["v*"]
env:
CARGO_TERM_COLOR: always
jobs:
image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
github-release:
runs-on: ubuntu-latest
needs: image
permissions:
contents: write
steps:
- uses: actions/checkout@v4
# Binary artifact is opt-in: set the repository variable
# RELEASE_BINARY=true to build and attach it.
- name: Cache rust toolchain
if: vars.RELEASE_BINARY == 'true'
uses: actions/cache@v4
with:
path: ~/.rustup/toolchains
key: rustup-${{ runner.os }}-1.97.0
- uses: dtolnay/rust-toolchain@stable
if: vars.RELEASE_BINARY == 'true'
with:
toolchain: "1.97.0"
- uses: Swatinem/rust-cache@v2
if: vars.RELEASE_BINARY == 'true'
- name: Build release binary
if: vars.RELEASE_BINARY == 'true'
run: |
cargo build --release --bin rustfs-operator
cp target/release/rustfs-operator rustfs-operator-linux-amd64
- uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
# the glob matches nothing when the binary step is skipped
files: |
deploy/crds.yaml
rustfs-operator-linux-amd64*
charts:
runs-on: ubuntu-latest
needs: image
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set chart versions from tag
run: |
version="${GITHUB_REF_NAME#v}"
for chart in charts/*/Chart.yaml; do
sed -i "s/^version:.*/version: ${version}/" "$chart"
sed -i "s/^appVersion:.*/appVersion: \"${version}\"/" "$chart"
done
- name: Configure git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Release chart to gh-pages
uses: helm/chart-releaser-action@v1
with:
charts_dir: charts
mark_as_latest: false
env:
CR_TOKEN: ${{ secrets.GITHUB_TOKEN }}