2021-02-18 20:38:32 +00:00
|
|
|
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:
|
2022-09-21 05:16:46 +00:00
|
|
|
ci:
|
2022-10-01 18:03:14 +00:00
|
|
|
uses: smallstep/certificates/.github/workflows/ci.yml@master
|
2022-09-24 06:18:45 +00:00
|
|
|
secrets: inherit
|
2021-02-18 20:38:32 +00:00
|
|
|
|
2021-02-23 05:05:24 +00:00
|
|
|
create_release:
|
|
|
|
name: Create Release
|
2022-10-26 04:26:50 +00:00
|
|
|
needs: ci
|
|
|
|
runs-on: ubuntu-latest
|
2022-10-27 06:31:02 +00:00
|
|
|
env:
|
|
|
|
DOCKER_IMAGE: smallstep/step-ca
|
2023-01-27 00:52:19 +00:00
|
|
|
DOCKER_IMAGE_HSM: smallstep/step-ca-hsm
|
2021-02-23 05:05:24 +00:00
|
|
|
outputs:
|
2022-10-27 06:31:02 +00:00
|
|
|
version: ${{ steps.extract-tag.outputs.VERSION }}
|
2021-02-23 05:05:24 +00:00
|
|
|
is_prerelease: ${{ steps.is_prerelease.outputs.IS_PRERELEASE }}
|
2022-10-27 06:31:02 +00:00
|
|
|
docker_tags: ${{ env.DOCKER_TAGS }}
|
2023-01-27 00:52:19 +00:00
|
|
|
docker_tags_hsm: ${{ env.DOCKER_TAGS_HSM }}
|
2021-02-23 05:05:24 +00:00
|
|
|
steps:
|
2022-10-01 18:03:14 +00:00
|
|
|
- name: Is Pre-release
|
2021-02-23 05:05:24 +00:00
|
|
|
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
|
2022-10-26 04:26:50 +00:00
|
|
|
echo "IS_PRERELEASE=${IS_PRERELEASE}" >> ${GITHUB_OUTPUT}
|
2022-10-27 06:31:02 +00:00
|
|
|
- name: Extract Tag Names
|
|
|
|
id: extract-tag
|
|
|
|
run: |
|
|
|
|
VERSION=${GITHUB_REF#refs/tags/v}
|
|
|
|
echo "VERSION=${VERSION}" >> ${GITHUB_OUTPUT}
|
|
|
|
echo "DOCKER_TAGS=${{ env.DOCKER_IMAGE }}:${VERSION}" >> ${GITHUB_ENV}
|
2023-01-27 00:52:19 +00:00
|
|
|
echo "DOCKER_TAGS_HSM=${{ env.DOCKER_IMAGE_HSM }}:${VERSION}" >> ${GITHUB_ENV}
|
2022-10-27 06:31:02 +00:00
|
|
|
- name: Add Latest Tag
|
|
|
|
if: steps.is_prerelease.outputs.IS_PRERELEASE == 'false'
|
|
|
|
run: |
|
|
|
|
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},${{ env.DOCKER_IMAGE }}:latest" >> ${GITHUB_ENV}
|
2023-01-27 00:52:19 +00:00
|
|
|
echo "DOCKER_TAGS_HSM=${{ env.DOCKER_TAGS_HSM }},${{ env.DOCKER_IMAGE_HSM }}:latest" >> ${GITHUB_ENV}
|
2022-10-01 18:03:14 +00:00
|
|
|
- name: Create Release
|
2021-02-23 05:05:24 +00:00
|
|
|
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:
|
2021-02-23 05:25:40 +00:00
|
|
|
name: Upload Assets To Github w/ goreleaser
|
2022-10-26 04:26:50 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-02-23 05:05:24 +00:00
|
|
|
needs: create_release
|
2022-10-26 04:26:50 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
contents: write
|
2021-02-18 20:38:32 +00:00
|
|
|
steps:
|
2022-10-01 18:03:14 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v3
|
2021-02-18 20:38:32 +00:00
|
|
|
with:
|
2022-08-08 19:01:18 +00:00
|
|
|
go-version: 1.19
|
2022-10-01 18:03:14 +00:00
|
|
|
check-latest: true
|
|
|
|
- name: Install cosign
|
2022-10-26 04:26:50 +00:00
|
|
|
uses: sigstore/cosign-installer@v2
|
2021-08-30 23:52:40 +00:00
|
|
|
with:
|
2022-10-26 04:26:50 +00:00
|
|
|
cosign-release: 'v1.13.1'
|
2022-10-01 18:03:14 +00:00
|
|
|
- name: Get Release Date
|
2021-09-11 20:05:17 +00:00
|
|
|
id: release_date
|
|
|
|
run: |
|
|
|
|
RELEASE_DATE=$(date +"%y-%m-%d")
|
2022-10-26 04:26:50 +00:00
|
|
|
echo "RELEASE_DATE=${RELEASE_DATE}" >> ${GITHUB_ENV}
|
2022-10-01 18:03:14 +00:00
|
|
|
- name: Run GoReleaser
|
|
|
|
uses: goreleaser/goreleaser-action@v3
|
2021-02-18 20:38:32 +00:00
|
|
|
with:
|
2022-10-01 18:03:14 +00:00
|
|
|
version: 'latest'
|
2021-02-18 20:38:32 +00:00
|
|
|
args: release --rm-dist
|
|
|
|
env:
|
2022-10-05 05:02:08 +00:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GORELEASER_PAT }}
|
2022-10-27 06:31:02 +00:00
|
|
|
RELEASE_DATE: ${{ env.RELEASE_DATE }}
|
2022-10-26 04:26:50 +00:00
|
|
|
COSIGN_EXPERIMENTAL: 1
|
2021-02-18 20:38:32 +00:00
|
|
|
|
2021-02-18 22:28:17 +00:00
|
|
|
build_upload_docker:
|
|
|
|
name: Build & Upload Docker Images
|
2022-10-27 06:31:02 +00:00
|
|
|
needs: create_release
|
2022-10-26 04:26:50 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
contents: write
|
2022-10-27 06:31:02 +00:00
|
|
|
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 }}
|
|
|
|
docker_image: smallstep/step-ca
|
2023-01-27 00:52:19 +00:00
|
|
|
docker_file: docker/Dockerfile
|
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
build_upload_docker_hsm:
|
|
|
|
name: Build & Upload HSM Enabled 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/386,linux/arm,linux/arm64
|
|
|
|
tags: ${{ needs.create_release.outputs.docker_tags_hsm }}
|
|
|
|
docker_image: smallstep/step-ca-hsm
|
|
|
|
docker_file: docker/Dockerfile.hsm
|
2022-10-27 06:31:02 +00:00
|
|
|
secrets: inherit
|