2021-04-30 22:23:51 +00:00
|
|
|
name: Create Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
version:
|
|
|
|
description: 'version to release, e.g. v1.5.13'
|
|
|
|
required: true
|
|
|
|
default: 'v0.1.0'
|
2023-05-15 07:06:15 +00:00
|
|
|
source_ref:
|
|
|
|
description: 'source ref to publish from. E.g.: main or release-x.y'
|
|
|
|
required: true
|
|
|
|
default: 'main'
|
2021-04-30 22:23:51 +00:00
|
|
|
|
|
|
|
env:
|
2022-10-06 17:14:13 +00:00
|
|
|
IMAGE_NAME: ghcr.io/${{ github.repository }}
|
2021-04-30 22:23:51 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
release:
|
|
|
|
name: Create Release
|
|
|
|
runs-on: ubuntu-latest
|
2022-03-19 20:07:50 +00:00
|
|
|
|
2021-04-30 22:23:51 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-03-07 08:06:46 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-04-30 22:23:51 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Create Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
tag_name: ${{ github.event.inputs.version }}
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
|
|
|
|
- name: Build Changelog
|
|
|
|
id: build_changelog
|
2022-04-18 13:31:37 +00:00
|
|
|
uses: mikepenz/release-changelog-builder-action@v3
|
2021-04-30 22:23:51 +00:00
|
|
|
with:
|
|
|
|
configuration: "changelog.json"
|
|
|
|
toTag: ${{ github.event.inputs.version }}
|
|
|
|
commitMode: true
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: create changelog file
|
|
|
|
run: |
|
2022-10-06 17:14:13 +00:00
|
|
|
echo "Image: \`${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}\`" >> .changelog
|
|
|
|
echo "Image: \`${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}-ubi\`" >> .changelog
|
2022-11-23 20:25:19 +00:00
|
|
|
echo "Image: \`${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}-ubi-boringssl\`" >> .changelog
|
2022-10-06 17:14:13 +00:00
|
|
|
echo "${{ steps.build_changelog.outputs.changelog }}" >> .changelog
|
2021-04-30 22:23:51 +00:00
|
|
|
|
|
|
|
- name: Update Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
tag_name: ${{ github.event.inputs.version }}
|
|
|
|
body_path: .changelog
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
|
2022-02-02 18:48:23 +00:00
|
|
|
- name: Setup Go
|
2023-03-20 22:00:25 +00:00
|
|
|
uses: actions/setup-go@v4
|
2022-02-02 18:48:23 +00:00
|
|
|
with:
|
2022-09-15 15:17:52 +00:00
|
|
|
go-version-file: "go.mod"
|
2022-02-02 18:48:23 +00:00
|
|
|
|
2022-12-11 12:32:50 +00:00
|
|
|
- name: Configure Git
|
|
|
|
run: |
|
|
|
|
git config user.name "$GITHUB_ACTOR"
|
|
|
|
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
|
|
|
|
2022-02-01 18:59:14 +00:00
|
|
|
- name: Update Docs
|
2023-05-15 07:06:15 +00:00
|
|
|
if: github.ref == 'refs/heads/main'
|
2022-02-01 18:59:14 +00:00
|
|
|
run: make docs.publish DOCS_VERSION=${{ github.event.inputs.version }} DOCS_ALIAS=latest
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
|
2021-04-30 22:23:51 +00:00
|
|
|
promote:
|
|
|
|
name: Promote Container Image
|
|
|
|
runs-on: ubuntu-latest
|
2022-10-06 17:14:13 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- tag_suffix: "" # distroless image
|
|
|
|
- tag_suffix: "-ubi" # ubi image
|
2022-11-23 20:25:19 +00:00
|
|
|
- tag_suffix: "-ubi-boringssl" # ubi image
|
2022-03-19 20:07:50 +00:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
id-token: write
|
2022-10-27 06:59:19 +00:00
|
|
|
contents: write
|
2022-03-19 20:07:50 +00:00
|
|
|
|
2022-10-06 17:14:13 +00:00
|
|
|
env:
|
2023-05-15 07:06:15 +00:00
|
|
|
SOURCE_TAG: ${{ github.event.inputs.source_ref }}${{ matrix.tag_suffix }}
|
2022-10-06 17:14:13 +00:00
|
|
|
RELEASE_TAG: ${{ github.event.inputs.version }}${{ matrix.tag_suffix }}
|
|
|
|
|
2021-04-30 22:23:51 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-03-07 08:06:46 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-04-30 22:23:51 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2022-04-05 12:38:57 +00:00
|
|
|
- name: Setup Go
|
2023-03-20 22:00:25 +00:00
|
|
|
uses: actions/setup-go@v4
|
2022-04-05 12:38:57 +00:00
|
|
|
with:
|
2022-09-15 15:17:52 +00:00
|
|
|
go-version-file: "go.mod"
|
2022-04-05 12:38:57 +00:00
|
|
|
|
|
|
|
- name: Find the Go Cache
|
|
|
|
id: go
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=build-cache::$(go env GOCACHE)"
|
|
|
|
echo "::set-output name=mod-cache::$(go env GOMODCACHE)"
|
|
|
|
|
|
|
|
- name: Cache the Go Build Cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ${{ steps.go.outputs.build-cache }}
|
2022-10-06 17:14:13 +00:00
|
|
|
key: ${{ runner.os }}-build-${{ github.sha }}-${{ hashFiles('**/go.sum') }}
|
2022-04-05 12:38:57 +00:00
|
|
|
|
|
|
|
- name: Cache Go Dependencies
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ${{ steps.go.outputs.mod-cache }}
|
2022-10-06 17:14:13 +00:00
|
|
|
key: ${{ runner.os }}-mod-${{ github.sha }}-${{ hashFiles('**/go.sum') }}
|
2022-04-05 12:38:57 +00:00
|
|
|
|
2021-04-30 22:23:51 +00:00
|
|
|
- name: Login to Docker
|
2022-05-09 08:05:30 +00:00
|
|
|
uses: docker/login-action@v2
|
2021-04-30 22:23:51 +00:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ secrets.GHCR_USERNAME }}
|
|
|
|
password: ${{ secrets.GHCR_TOKEN }}
|
|
|
|
|
|
|
|
- name: Promote Container Image
|
|
|
|
run: make docker.promote
|
2022-03-19 20:07:50 +00:00
|
|
|
|
2022-11-23 19:10:15 +00:00
|
|
|
- name: Build release manifests
|
|
|
|
run: make manifests
|
|
|
|
|
2022-10-06 17:14:13 +00:00
|
|
|
- name: Sign promoted image
|
2022-10-27 06:59:19 +00:00
|
|
|
id: sign
|
2022-10-06 17:14:13 +00:00
|
|
|
uses: ./.github/actions/sign
|
|
|
|
with:
|
|
|
|
image-name: ${{ env.IMAGE_NAME }}
|
|
|
|
image-tag: ${{ env.RELEASE_TAG }}
|
|
|
|
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
|
|
|
|
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-10-27 06:59:19 +00:00
|
|
|
|
|
|
|
- name: Update Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
tag_name: ${{ github.event.inputs.version }}
|
|
|
|
files: |
|
|
|
|
provenance.${{ env.RELEASE_TAG }}.intoto.jsonl
|
|
|
|
sbom.${{ env.RELEASE_TAG }}.spdx.json
|
2022-11-23 19:10:15 +00:00
|
|
|
bin/deploy/manifests/external-secrets.yaml
|
2022-10-27 06:59:19 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|