Skip to content

Create Release

Create Release #3

Workflow file for this run

name: Create Release
on:
workflow_dispatch:
inputs:
version:
description: 'version to release, e.g. v1.5.13'
required: true
default: 'v0.1.0'
source_ref:
description: 'source ref to publish from. E.g.: main or release-x.y'
required: true
default: 'main'
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
ref: ${{ github.event.inputs.source_ref }}
- name: Sanitize repo slug
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
id: repo_slug
with:
result-encoding: string
script: return 'ghcr.io/${{ github.repository }}'.toLowerCase()
- name: Create Release
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
with:
tag_name: ${{ github.event.inputs.version }}
target_commitish: ${{ github.event.inputs.source_ref }}
generate_release_notes: true
body: |
Image: `${{ steps.repo_slug.outputs.result }}:${{ github.event.inputs.version }}`
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
repo-slug:
runs-on: ubuntu-latest
outputs:
repo_slug: ${{ steps.repo_slug.outputs.result }}
steps:
- name: Sanitize repo slug
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
id: repo_slug
with:
result-encoding: string
script: return 'ghcr.io/${{ github.repository }}'.toLowerCase()
promote:
name: Promote Container Image
runs-on: ubuntu-latest
needs: [release, repo-slug]
permissions:
contents: write
packages: write
env:
SOURCE_TAG: ${{ github.event.inputs.source_ref }}
RELEASE_TAG: ${{ github.event.inputs.version }}
IMAGE_NAME: ${{ needs.repo-slug.outputs.repo_slug }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
id: setup-go
with:
go-version-file: "go.mod"
- name: Download Go modules
if: ${{ steps.setup-go.outputs.cache-hit != 'true' }}
run: go mod download
- name: Login to Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Promote Container Image
run: make docker-promote
- name: Build release manifests
run: |
make build-installer
- name: Update Release
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
with:
tag_name: ${{ github.event.inputs.version }}
files: |
deploy/bundle.yaml
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"