-
Notifications
You must be signed in to change notification settings - Fork 6
137 lines (129 loc) · 4.82 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
132
133
134
135
136
137
name: Create Release & Upload Assets
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
ci:
uses: smallstep/step-kms-plugin/.github/workflows/ci.yml@main
secrets: inherit
create_release:
name: Create Release
needs: ci
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: smallstep/step-kms-plugin
CLOUD_TAG: cloud
DEBIAN_TAG: bookworm
WOLFI_TAG: wolfi
outputs:
version: ${{ steps.extract-tag.outputs.VERSION }}
is_prerelease: ${{ steps.is_prerelease.outputs.IS_PRERELEASE }}
docker_tags: ${{ env.DOCKER_TAGS }}
docker_tags_cloud: ${{ env.DOCKER_TAGS_CLOUD }}
docker_tags_debian: ${{ env.DOCKER_TAGS_DEBIAN }}
docker_tags_wolfi: ${{ env.DOCKER_TAGS_WOLFI }}
steps:
- name: Is Pre-release
id: is_prerelease
run: |
set +e
echo ${{ github.ref }} | grep "\-rc.*"
OUT=$?
if [ $OUT -eq 0 ]; then IS_PRERELEASE=true; else IS_PRERELEASE=false; fi
echo "IS_PRERELEASE=${IS_PRERELEASE}" >> "${GITHUB_OUTPUT}"
- name: Extract Tag Names
id: extract-tag
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=${VERSION}" >> "${GITHUB_OUTPUT}"
# shellcheck disable=SC2129
echo "DOCKER_TAGS=${{ env.DOCKER_IMAGE }}:${VERSION}" >> "${GITHUB_ENV}"
echo "DOCKER_TAGS_CLOUD=${{ env.DOCKER_IMAGE }}:${VERSION}-${CLOUD_TAG}" >> "${GITHUB_ENV}"
echo "DOCKER_TAGS_DEBIAN=${{ env.DOCKER_IMAGE }}:${VERSION}-${DEBIAN_TAG}" >> "${GITHUB_ENV}"
echo "DOCKER_TAGS_WOLFI=${{ env.DOCKER_IMAGE }}:${VERSION}-${WOLFI_TAG}" >> "${GITHUB_ENV}"
- name: Add Latest Tag
if: steps.is_prerelease.outputs.IS_PRERELEASE == 'false'
run: |
# shellcheck disable=SC2129
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},${{ env.DOCKER_IMAGE }}:latest" >> "${GITHUB_ENV}"
echo "DOCKER_TAGS_CLOUD=${{ env.DOCKER_IMAGE }}:${CLOUD_TAG}" >> "${GITHUB_ENV}"
echo "DOCKER_TAGS_DEBIAN=${{ env.DOCKER_IMAGE }}:${DEBIAN_TAG}" >> "${GITHUB_ENV}"
echo "DOCKER_TAGS_WOLFI=${{ env.DOCKER_IMAGE }}:${WOLFI_TAG}" >> "${GITHUB_ENV}"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: ${{ steps.is_prerelease.outputs.IS_PRERELEASE }}
goreleaser:
name: Upload Assets to Github w/ goreleaser
runs-on: ubuntu-latest
needs: create_release
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: setup release environment
run: |-
echo 'GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}' > .release-env
- name: release publish
run: make release
build_upload_docker:
name: Build & Upload Docker Image
needs: create_release
permissions:
id-token: write
contents: write
uses: smallstep/workflows/.github/workflows/docker-buildx-push.yml@main
with:
platforms: linux/amd64,linux/arm64,linux/386,linux/arm
tags: ${{ needs.create_release.outputs.docker_tags }}
docker_image: smallstep/step-kms-plugin
docker_file: docker/Dockerfile
secrets: inherit
build_upload_docker_debian:
name: Build & Upload Debian Docker Image
needs: create_release
permissions:
id-token: write
contents: write
uses: smallstep/workflows/.github/workflows/docker-buildx-push.yml@main
with:
platforms: linux/amd64,linux/386,linux/arm,linux/arm64
tags: ${{ needs.create_release.outputs.docker_tags_debian }}
docker_image: smallstep/step-kms-plugin
docker_file: docker/Dockerfile.debian
secrets: inherit
build_upload_docker_cloud:
name: Build & Upload Cloud-Only Docker Image
needs: create_release
permissions:
id-token: write
contents: write
uses: smallstep/workflows/.github/workflows/docker-buildx-push.yml@main
with:
platforms: linux/amd64,linux/arm64,linux/386,linux/arm
tags: ${{ needs.create_release.outputs.docker_tags_cloud }}
docker_image: smallstep/step-kms-plugin
docker_file: docker/Dockerfile.cloud
secrets: inherit
build_upload_docker_wolfi:
name: Build & Upload Wolfi Docker Image
needs: create_release
permissions:
id-token: write
contents: write
uses: smallstep/workflows/.github/workflows/docker-buildx-push.yml@main
with:
platforms: linux/amd64
tags: ${{ needs.create_release.outputs.docker_tags_wolfi }}
docker_image: smallstep/step-kms-plugin
docker_file: docker/Dockerfile.wolfi
secrets: inherit