This repository has been archived by the owner on May 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
113 lines (96 loc) · 3.17 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
109
110
111
112
name: release
on:
push:
tags:
- 'v*.*.*'
jobs:
build_and_push_images:
name: Build and Release image to Docker Hub
runs-on: ubuntu-22.04
strategy:
matrix:
id: [ "manager", "proxy-init", "ingress-pipy" ]
steps:
- name: Install Cosign
uses: sigstore/cosign-installer@main
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.FLOMESH_DOCKERHUB_USERNAME }}
password: ${{ secrets.FLOMESH_DOCKERHUB_PASSWORD }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Package Helm Charts
run: make charts-tgz-rel
- name: Docker meta - ${{ matrix.id }}
id: docker_meta
uses: crazy-max/[email protected]
with:
images: flomesh/erie-canal-${{ matrix.id }}
tags: |
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
type=sha,format=long
flavor: |
latest=auto
- name: Build and Push - ${{ matrix.id }}
id: docker_build_push
uses: docker/[email protected]
with:
context: .
file: ./dockerfiles/${{ matrix.id }}/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ (github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == format('refs/heads/{0}', github.event.repository.default_branch) )) }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: |
DISTROLESS_TAG=nonroot
- name: Sign image with a key - ${{ matrix.id }}
run: |
cosign sign --yes --key env://COSIGN_PRIVATE_KEY flomesh/erie-canal-${{ matrix.id }}@${IMAGE_DIGEST}
env:
TAGS: ${{ steps.docker_meta.outputs.tags }}
IMAGE_DIGEST: ${{ steps.docker_build_push.outputs.digest }}
COSIGN_PRIVATE_KEY: ${{secrets.COSIGN_PRIVATE_KEY}}
COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}}
release_project:
name: Create Github Release
runs-on: ubuntu-22.04
needs:
- build_and_push_images
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
check-latest: true
cache: true
- name: Install packages
run: sudo apt-get install -y git make
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
git_push_gpgsign: true
- name: Run GoReleaser
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
run: make gh-release