-
Notifications
You must be signed in to change notification settings - Fork 65
108 lines (89 loc) · 3.64 KB
/
release.yml
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
name: Release Godaddy Webhook Helm Chart
on:
workflow_dispatch:
inputs:
version:
description: 'The version you want to release (e.g 0.3.0).'
required: true
jobs:
release:
runs-on: ubuntu-latest
# if: contains(github.event.head_commit.message, '[to_release]')
permissions:
contents: write # for creating Releases .tgz (403 from chart-releaser-action if not set)
#pages: write # not required for chart-releaser-action
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v3
- name: Create release branch
run: git checkout -b release/${{ github.event.inputs.version }}
- name: Tag chart and image version
id: tag-chart
run: |
export TAG_VERSION=${{ github.event.inputs.version }}
echo "Tag version: ${TAG_VERSION}"
yq '.appVersion = env(TAG_VERSION)' -i ./deploy/charts/godaddy-webhook/Chart.yaml
yq '.version = env(TAG_VERSION)' -i ./deploy/charts/godaddy-webhook/Chart.yaml
yq '.image.tag = env(TAG_VERSION)' -i ./deploy/charts/godaddy-webhook/values.yaml
echo "Git status ..."
git status
git branch
git commit -asm "Update Helm chart version to $TAG_VERSION"
echo "Git status ..."
git status
git push origin release/${TAG_VERSION}
echo "TAG_VERSION=${TAG_VERSION}" >> "${GITHUB_OUTPUT}"
# - name: Login to Quay.io Hub
# uses: docker/login-action@v1
# with:
# registry: quay.io
# username: ${{ secrets.QUAY_ROBOT_USER }}
# password: ${{ secrets.QUAY_ROBOT_TOKEN }}
#
# - name: Build the container image
# run: |
# NEW_VERSION="${{ steps.tag-chart.outputs.TAG_VERSION }}"
# docker build -t cert-manager-webhook-godaddy:${NEW_VERSION} -f Dockerfile .
#
# TAG_ID=$(docker images -q cert-manager-webhook-godaddy:${NEW_VERSION})
# docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:${NEW_VERSION}
# docker push quay.io/snowdrop/cert-manager-webhook-godaddy:${NEW_VERSION}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build & push Docker image
uses: mr-smithers-excellent/docker-build-push@v6
with:
image: snowdrop/cert-manager-webhook-godaddy
tags: ${{ steps.tag-chart.outputs.TAG_VERSION }}, latest
enableBuildKit: true
multiPlatform: true
platform: linux/amd64,linux/arm64
registry: quay.io
username: ${{ secrets.QUAY_ROBOT_USER }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: deploy/charts
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Push back the release branch and delete it
run: |
TAG_VERSION="${{ steps.tag-chart.outputs.TAG_VERSION }}"
git checkout main
git pull
git merge release/${TAG_VERSION}
git push origin main
echo "Tagging main"
git tag v${TAG_VERSION}
git push origin v${TAG_VERSION}
# TODO: Should we delete it ??
git push origin --delete release/${{ steps.tag-chart.outputs.TAG_VERSION }}