forked from baarde/cert-manager-webhook-ovh
-
Notifications
You must be signed in to change notification settings - Fork 16
126 lines (108 loc) · 3.79 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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.
name: cert-manager-webhook-ovh actions
on:
push:
tags:
- 0*
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{raw}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/arm64,linux/arm/v7,linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
chart-release:
needs:
- build-and-push-image
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: tag-checkout-code
uses: actions/checkout@v4
with:
# # Fetch entire history. Required for chart-releaser; see https://github.com/helm/chart-releaser-action/issues/13#issuecomment-602063896
fetch-depth: 0
- name: tag-package-chart
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cp LICENSE charts/cert-manager-webhook-ovh/
cp README.md charts/cert-manager-webhook-ovh/
mkdir -p tmp/packages
helm package --destination tmp/packages/ charts/cert-manager-webhook-ovh/
cp charts/cert-manager-webhook-ovh/Chart.yaml tmp/
cp artifacthub-repo.yml tmp/
- name: tag-upload-artifacts
uses: actions/upload-artifact@v4
with:
name: chart-archive
path: tmp/
- name: gh-page-checkout-code
uses: actions/checkout@v4
with:
ref: 'gh-pages'
# Fetch entire history. Required for chart-releaser; see https://github.com/helm/chart-releaser-action/issues/13#issuecomment-602063896
fetch-depth: 0
- name: gh-pages-download-artifacts
uses: actions/download-artifact@v4
with:
name: chart-archive
path: tmp
- name: gh-page-configure-git
shell: bash
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: gh-page-index-chart-repo
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
test -d packages || mkdir packages
gh release upload "$GITHUB_REF_NAME" tmp/packages/*
mv tmp/packages/* packages/
mv tmp/Chart.yaml ./
mv tmp/artifacthub-repo.yml ./
helm repo index --url "https://$GITHUB_ACTOR.github.io/$(echo "$GITHUB_REPOSITORY" | cut --delimiter / --fields=2)" .
git add artifacthub-repo.yml index.yaml packages/
git status
git commit -m "Publish $GITHUB_REF_NAME"
git push origin gh-pages