forked from grpc-ecosystem/grpc-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (95 loc) · 3.16 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
on:
push:
tags:
- v2.[0-9]+.[0-9]+
permissions:
contents: read
name: release
jobs:
goreleaser:
outputs:
hashes: ${{ steps.hash.outputs.hashes }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
check-latest: true
- uses: goreleaser/goreleaser-action@v3
id: run-goreleaser
with:
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate subject
id: hash
env:
ARTIFACTS: "${{ steps.run-goreleaser.outputs.artifacts }}"
META: "${{ steps.run-goreleaser.outputs.metadata }}"
run: |
set -euo pipefail
echo "artifacts:"
echo "$ARTIFACTS"
echo "META:"
echo "$META"
pwd
tree
checksum_file=$(cat _output/artifacts.json | jq -r '.[] | select (.type=="Checksum") | .path')
echo "checksum_file:"
echo "$checksum_file"
echo "::set-output name=hashes::$(cat $checksum_file | base64 -w0)"
test:
runs-on: ubuntu-latest
needs: [goreleaser]
steps:
- run: |
echo "hashes:"
echo "${{ needs.goreleaser.outputs.hashes }}"
provenance:
needs: [goreleaser]
permissions:
actions: read # To read the workflow path.
id-token: write # To sign the provenance.
contents: write # To add assets to a release.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.2.0
with:
base64-subjects: "${{ needs.goreleaser.outputs.hashes }}"
upload-assets: true # upload to a new release
push_bsr_plugins:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: plugins.buf.build
username: grpcgatewaybot
password: ${{ secrets.BUF_TOKEN }}
- name: Set protobuf-version
run: echo ::set-output name=version::$(go list -m -f '{{.Version}}' google.golang.org/protobuf)
id: protobuf-version
- name: Set grpc-version
run: echo ::set-output name=version::$(go list -m -f '{{.Version}}' google.golang.org/grpc)
id: grpc-version
- uses: docker/build-push-action@v3
with:
push: true
tags: plugins.buf.build/grpc-ecosystem/grpc-gateway:${{ github.ref_name }}-1
context: .github/plugins/protoc-gen-grpc-gateway
platforms: linux/amd64
build-args: |
RELEASE_VERSION=${{ github.ref_name }}
GO_PROTOBUF_RELEASE_VERSION=${{ steps.protobuf-version.outputs.version }}
GO_GRPC_RELEASE_VERSION=${{ steps.grpc-version.outputs.version }}
- uses: docker/build-push-action@v3
with:
push: true
tags: plugins.buf.build/grpc-ecosystem/openapiv2:${{ github.ref_name }}-1
context: .github/plugins/protoc-gen-openapiv2
platforms: linux/amd64
build-args: |
RELEASE_VERSION=${{ github.ref_name }}