-
Notifications
You must be signed in to change notification settings - Fork 454
131 lines (131 loc) · 5 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
on:
release:
types: [created]
name: Handle Release
jobs:
builder:
name: Generate builder containers
runs-on: ubuntu-20.04
steps:
- name: Checkout the repository
uses: actions/checkout@master
- name: Set the environment variables
run: |
echo "GOLANG_VERSION=$(grep -m 1 GOLANG_VERSION Makefile | sed 's/^.*= //g')" >> $GITHUB_ENV
echo "ALPINE_VERSION=$(grep -m 1 ALPINE_VERSION Makefile | sed 's/^.*= //g')" >> $GITHUB_ENV
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
krakend/builder
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Docker meta
id: meta-linux-generic
uses: docker/metadata-action@v4
with:
images: |
krakend/builder
flavor: |
suffix=-linux-generic,onlatest=true
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push KrakenD plugin builder (Alpine)
id: container-build
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile-builder
build-args: |
GOLANG_VERSION=${{ env.GOLANG_VERSION }}
ALPINE_VERSION=${{ env.ALPINE_VERSION }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build and push KrakenD plugin builder (Linux generic)
id: container-build-linux-generic
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile-builder-linux
build-args: |
GOLANG_VERSION=${{ env.GOLANG_VERSION }}
push: true
tags: ${{ steps.meta-linux-generic.outputs.tags }}
labels: ${{ steps.meta-linux-generic.outputs.labels }}
- name: Install cosign
uses: sigstore/[email protected]
- name: Sign image (Alpine)
run: |
cosign sign -y "docker.io/krakend/builder@${{ steps.container-build.outputs.digest }}"
- name: Sign image (Linux generic)
run: |
cosign sign -y "docker.io/krakend/builder@${{ steps.container-build-linux-generic.outputs.digest }}"
generate:
name: Create release-artifacts
runs-on: ubuntu-20.04
needs: builder
steps:
- name: Checkout the repository
uses: actions/checkout@master
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.PGP_SIGNING_KEY }}
fingerprint: "5B270F2E01E375FD9D5635E25DE6FD698AD6FDD2"
- name: List keys
run: gpg -K
- name: Generate the artifacts for Debian/Ubuntu/Redhat/Centos (AMD64/ARM64)
uses: docker://krakend/builder:latest-linux-generic
with:
args: sh -c "git config --global --add safe.directory /github/workspace;
export CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc ARCH=arm64 OS_TAG=_generic-linux GOARCH=arm64 GOHOSTARCH=amd64 EXTRA_LDFLAGS='-extld=aarch64-linux-gnu-gcc';
make -e build && make -e tgz;
make clean;
export CC= GOARCH=amd64 ARCH=amd64 OS_TAG=_generic-linux EXTRA_LDFLAGS=;
make -e build && make -e tgz;"
- name: Build DEB package (AMD64)
uses: docker://krakend/fpm:deb
with:
entrypoint: /bin/bash
args: -c "make -e deb-release"
- name: Build RPM package (AMD64)
uses: docker://krakend/fpm:rpm
with:
entrypoint: /bin/bash
args: -c "echo '${{ secrets.PGP_SIGNING_KEY }}' > pgp.key;
gpg --import pgp.key;
cp builder/files/rpmmacros /etc/rpm/macros;
make -e rpm-release &&
rpmsign --addsign *rpm"
- name: Generate the artifacts for Alpine (AMD64/ARM64)
uses: docker://krakend/builder:latest
with:
args: sh -c "export GOARCH=amd64 ARCH=amd64 OS_TAG=_alpine;
make -e build && make -e tgz;
make clean;
export CGO_ENABLED=1 ARCH=arm64 OS_TAG=_alpine GOARCH=arm64 GOHOSTARCH=amd64;
export CC=aarch64-linux-musl-gcc EXTRA_LDFLAGS='-extldflags=-fuse-ld=bfd -extld=aarch64-linux-musl-gcc';
make -e build && make -e tgz"
- name: ASC files
run: for i in $(ls *.tar.gz *.deb *.rpm);
do gpg --armor --detach $i;
sha512sum $i >> checksums.txt;
done
- name: Upload the artifacts
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: '*.tar.gz *.asc *.deb *.rpm checksums.txt'