-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (75 loc) · 2.53 KB
/
release-please.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
name: Release-please
on:
push:
branches:
- main
permissions: write-all
env:
DOCKER_PATH: ./docker
DOCKER_IMAGE: 36node/mongodb-backup
HARBOR_REGISTRY: harbor.36node.com
HARBOR_REPO: common
CHART_NAME: mongodb-backup-chart
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: google-github-actions/release-please-action@v4
id: release
with:
release-type: simple
docker-and-helm:
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version tag
id: get_tag
# needs.release-please.outputs.tag_name = v1.0.0
run: echo ::set-output name=VERSION::$(echo "${{ needs.release-please.outputs.tag_name }}" | cut -c 2-)
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.DOCKER_IMAGE }}
# steps.get_tag.outputs.VERSION = v1.0.0
tags: |
${{ steps.get_tag.outputs.VERSION }}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: "${{ secrets.DOCKERHUB_USERNAME }}"
password: "${{ secrets.DOCKERHUB_TOKEN }}"
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ env.DOCKER_PATH }}
push: true
# steps.meta.outputs.tags = xxx/xxx:v1.0.0
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Chart package and push
uses: appany/[email protected]
with:
name: ${{ env.CHART_NAME }}
repository: ${{ env.HARBOR_REPO }}
# v1.0.0 -> 1.0.0
tag: $(echo "${{ steps.get_tag.outputs.VERSION }}" | sed 's/v\([0-9.]*\).*/\1/')
path: helm-chart
registry: ${{ env.HARBOR_REGISTRY }}
registry_username: "${{ secrets.HARBOR_USERNAME }}"
registry_password: "${{ secrets.HARBOR_PASSWORD }}"