Skip to content

Release

Release #18

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
prerelease:
default: true
description: Is this a pre-release version?
required: true
type: boolean
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.BOT_PAT }}
- name: bundle channel
id: bundle_channel
run: |
if [ "${{ github.event.inputs.prerelease }}" == "true" ]; then
echo "channel=alpha" >> $GITHUB_OUTPUT
else
echo "channel=stable" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Conventional Changelog Action
id: version
uses: TriPSs/conventional-changelog-action@v3
with:
release-count: '1'
skip-version-file: 'true'
skip-commit: 'true'
skip-git-pull: 'true'
git-push: 'false'
git-path: ". '!:labsdk'"
tag-prefix: 'v'
fallback-version: '0.3.0'
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: '^1.21'
- # Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push the containers
run: |
make generate docker-build bundle installer \
VERSION=${{ steps.version.outputs.version }} \
BUNDLE_VERSION=${{ steps.version.outputs.tag }} \
CHANNELS=${{ steps.bundle_channel.outputs.channel }} \
DOCKER_BUILD_FLAGS="--platform linux/amd64,linux/arm64 --push"
ENV=prod
docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-bundle
- name: Update changelog
shell: bash
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
touch CHANGELOG.md
echo -e "${{ steps.version.outputs.changelog }}\n\n$(cat CHANGELOG.md)" > CHANGELOG.md
git add CHANGELOG.md
git commit -m "chore(release): ${{ steps.version.outputs.version }}" CHANGELOG.md
git push
- name: Tag
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ steps.version.outputs.tag }}',
sha: context.sha
})
- name: Release on GitHub
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.tag }}
body: |
${{ steps.version.outputs.clean_changelog }}
prerelease: ${{ inputs.prerelease }}
name: Version ${{ steps.version.outputs.version }}
generate_release_notes: false