Release #10
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
prerelease: | |
description: "Prerelease" | |
required: true | |
default: false | |
type: boolean | |
draft: | |
description: "Draft" | |
required: true | |
default: false | |
type: boolean | |
version-increment-type: | |
description: 'Which part of the version to increment:' | |
required: true | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
default: 'patch' | |
permissions: | |
contents: write | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
# Check out the repo with credentials that can bypass branch protection, and fetch git history instead of just latest commit | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: taplytics-robot | |
password: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- uses: DevCycleHQ/release-action/prepare-release@v2 | |
id: prepare-release | |
with: | |
github-token: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
prerelease: ${{ github.event.inputs.prerelease }} | |
draft: ${{ github.event.inputs.draft }} | |
version-increment-type: ${{ github.event.inputs.version-increment-type }} | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: stable | |
- name: Build and push Docker image | |
uses: docker/[email protected] | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- uses: DevCycleHQ/release-action/create-release@v2 | |
id: create-release | |
with: | |
github-token: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
tag: ${{ steps.prepare-release.outputs.next-release-tag }} | |
target: main | |
prerelease: ${{ github.event.inputs.prerelease }} | |
draft: ${{ github.event.inputs.draft }} | |
changelog: ${{ steps.prepare-release.outputs.changelog }} | |
- name: Display link to release | |
run: | | |
echo "::notice title=Release ID::${{ steps.create-release.outputs.release-id }}" | |
echo "::notice title=Release URL::${{ steps.create-release.outputs.release-url }}" |