Merge pull request #284 from smallstep/max/goreleaser-permissions #22
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/autocert/.github/workflows/ci.yml@master | |
secrets: inherit | |
create_release: | |
name: Create Release | |
needs: ci | |
runs-on: ubuntu-latest | |
env: | |
INIT_DOCKER_IMAGE: smallstep/autocert-init | |
BOOTSTRAPPER_DOCKER_IMAGE: smallstep/autocert-bootstrapper | |
RENEWER_DOCKER_IMAGE: smallstep/autocert-renewer | |
CONTROLLER_DOCKER_IMAGE: smallstep/autocert-controller | |
outputs: | |
version: ${{ steps.extract-tag.outputs.VERSION }} | |
vversion: ${{ steps.extract-tag.outputs.VVERSION }} | |
is_prerelease: ${{ steps.is_prerelease.outputs.IS_PRERELEASE }} | |
init_docker_tags: ${{ env.INIT_DOCKER_TAGS }} | |
bootstrapper_docker_tags: ${{ env.BOOTSTRAPPER_DOCKER_TAGS }} | |
renewer_docker_tags: ${{ env.RENEWER_DOCKER_TAGS }} | |
controller_docker_tags: ${{ env.CONTROLLER_DOCKER_TAGS }} | |
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: | | |
VVERSION="${GITHUB_REF#refs/tags/}" | |
VERSION="${GITHUB_REF#refs/tags/v}" | |
# shellcheck disable=SC2129 | |
echo "VVERSION=${VVERSION}" >> "${GITHUB_OUTPUT}" | |
echo "VERSION=${VERSION}" >> "${GITHUB_OUTPUT}" | |
# shellcheck disable=SC2129 | |
echo "INIT_DOCKER_TAGS=${{ env.INIT_DOCKER_IMAGE }}:${VERSION}" >> "${GITHUB_ENV}" | |
echo "BOOTSTRAPPER_DOCKER_TAGS=${{ env.BOOTSTRAPPER_DOCKER_IMAGE }}:${VERSION}" >> "${GITHUB_ENV}" | |
echo "RENEWER_DOCKER_TAGS=${{ env.RENEWER_DOCKER_IMAGE }}:${VERSION}" >> "${GITHUB_ENV}" | |
echo "CONTROLLER_DOCKER_TAGS=${{ env.CONTROLLER_DOCKER_IMAGE }}:${VERSION}" >> "${GITHUB_ENV}" | |
- name: Add Latest Tag | |
if: steps.is_prerelease.outputs.IS_PRERELEASE == 'false' | |
run: | | |
# shellcheck disable=SC2129 | |
echo "INIT_DOCKER_TAGS=${{ env.INIT_DOCKER_TAGS }},${{ env.INIT_DOCKER_IMAGE }}:latest" >> "${GITHUB_ENV}" | |
echo "BOOTSTRAPPER_DOCKER_TAGS=${{ env.BOOTSTRAPPER_DOCKER_TAGS }},${{ env.BOOTSTRAPPER_DOCKER_IMAGE }}:latest" >> "${GITHUB_ENV}" | |
echo "RENEWER_DOCKER_TAGS=${{ env.RENEWER_DOCKER_TAGS }},${{ env.RENEWER_DOCKER_IMAGE }}:latest" >> "${GITHUB_ENV}" | |
echo "CONTROLLER_DOCKER_TAGS=${{ env.CONTROLLER_DOCKER_TAGS }},${{ env.CONTROLLER_DOCKER_IMAGE }}:latest" >> "${GITHUB_ENV}" | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
name: Release ${{ github.ref_name }} | |
draft: false | |
prerelease: ${{ steps.is_prerelease.outputs.IS_PRERELEASE }} | |
goreleaser: | |
needs: create_release | |
permissions: | |
id-token: write | |
contents: write | |
packages: write | |
uses: smallstep/workflows/.github/workflows/goreleaser.yml@main | |
secrets: inherit | |
build_upload_docker_autocert_init: | |
name: Build & Upload Autocert Init Docker Images | |
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 | |
tags: ${{ needs.create_release.outputs.init_docker_tags }} | |
docker_image: smallstep/autocert-init | |
docker_file: init/Dockerfile | |
secrets: inherit | |
build_upload_docker_autocert_renewer: | |
name: Build & Upload Autocert Renewer Images | |
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 | |
tags: ${{ needs.create_release.outputs.renewer_docker_tags }} | |
docker_image: smallstep/autocert-renewer | |
docker_file: renewer/Dockerfile | |
secrets: inherit | |
build_upload_docker_autocert_bootstrapper: | |
name: Build & Upload Autocert Bootstrapper Images | |
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 | |
tags: ${{ needs.create_release.outputs.bootstrapper_docker_tags }} | |
docker_image: smallstep/autocert-bootstrapper | |
docker_file: bootstrapper/Dockerfile | |
secrets: inherit | |
build_upload_docker_autocert_controller: | |
name: Build & Upload Autocert Bootstrapper Images | |
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 | |
tags: ${{ needs.create_release.outputs.controller_docker_tags }} | |
docker_image: smallstep/autocert-controller | |
docker_file: controller/Dockerfile | |
secrets: inherit |