Skip to content

Release 0.2.2 by strokyl #23

Release 0.2.2 by strokyl

Release 0.2.2 by strokyl #23

Workflow file for this run

name: Release
run-name: Release ${{ github.event.release.tag_name }} by ${{ github.actor }}
on:
release:
types: [published]
env:
GO_VERSION: 1.22.0
jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: go test
run: go test ./...
integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: run test
run: ./test_final_exec.sh
build-exec:
needs: [unit-test, integration-test]
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "${{ env.GO_VERSION }}"
ldflags: -X 'github.com/conduktor/ctl/utils.version=${{ github.event.release.tag_name }}' -X 'github.com/conduktor/ctl/utils.hash=${{ github.sha }}'
project_path: "./"
binary_name: "conduktor"
bump:
needs: [unit-test, integration-test]
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.CONDUKTORBOT_GHCR_RW }}
APP_VERSION: ${{ github.event.release.tag_name }}
APP_SHA: ${{ github.sha }}
steps:
- run: env
shell: bash
- uses: actions/checkout@v3
with:
repository: 'conduktor/homebrew-brew'
ref: main
path: homebrew-brew
token: ${{ secrets.CONDUKTORBOT_REPO_WRITE }}
- name: Update conduktor-ctl on homebrew
env:
GH_TOKEN: ${{ secrets.CONDUKTORBOT_REPO_WRITE }}
run: |
yq --version
gh version
gh auth status
export BRANCH=update_console-plus_$APP_VERSION
echo BRANCH $BRANCH
export BASE_BRANCH=main
echo BASE_BRANCH $BASE_BRANCH
export TITLE="Bump conduktor-ctl version to ${APP_VERSION}"
export BODY="Release https://github.com/conduktor/ctl/releases/tag/${APP_VERSION}"
export MESSAGE="${TITLE} .${BODY}"
echo TITLE $TITLE
echo BODY $BODY
echo MESSAGE $MESSAGE
cd homebrew-brew
git config user.name github-actions
git config user.email [email protected]
git checkout -b $BRANCH
sed -i 's/version "[^"]*"/version "'"$APP_VERSION"'"/' Formula/conduktor-cli.rb
sed -i 's/gitSha\s*=\s*"[^"]*"/gitSha = "'"$APP_SHA"'"/' Formula/conduktor-cli.rb
git add Formula/conduktor-cli.rb
git commit -m "$MESSAGE"
git push origin $BRANCH
gh pr create --title "$TITLE" --body "$BODY" --repo 'https://github.com/conduktor/homebrew-brew' --base $BASE_BRANCH
cd ..
build-docker:
name: Build and publish conduktor-ctl image
needs: [unit-test, integration-test]
runs-on: ubuntu-latest
env:
IMAGE_NAME: "conduktor-ctl"
LABEL_IMAGE_TITLE: "Conduktor ctl"
LABEL_IMAGE_DESCRIPTION: "Conduktor command line tools"
LABEL_IMAGE_AUTHORS: "Conduktor <[email protected]>"
LABEL_IMAGE_URL: "https://hub.docker.com/r/conduktor/conduktor-ctl"
LABEL_IMAGE_DOCUMENTATION: "https://docs.conduktor.io/conduktor"
LABEL_IMAGE_VENDOR: "Conduktor.io"
LABEL_IMAGE_LICENSE: "Apache-2.0"
PLATFORMS: "linux/amd64,linux/arm64"
steps:
- uses: actions/checkout@v3
- name: "Set latest"
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
latest_release_version=$(gh release view -R ${{ github.repository }} --json tagName -q .tagName)
is_latest=$(test "${{ github.event.release.tag_name }}" == "${latest_release_version}" && echo true || echo false)
echo "IS_LATEST=${is_latest}" >> $GITHUB_ENV
- uses: docker/setup-buildx-action@v3
with:
platforms: ${{ env.PLATFORMS }}
- uses: docker/setup-qemu-action@v3
with:
platforms: ${{ env.PLATFORMS }}
- uses: docker/login-action@v2
with:
username: ${{ secrets.CONDUKTORBOT_DOCKER_HUB_USERNAME }}
password: ${{ secrets.CONDUKTORBOT_DOCKER_HUB_PAT }}
- uses: docker/metadata-action@v4
id: docker_meta
with:
images: docker.io/conduktor/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ github.event.release.tag_name }}
type=raw,value=latest,enable=${{ env.IS_LATEST }}
labels: |
org.opencontainers.image.title=${{ env.LABEL_IMAGE_TITLE }}
org.opencontainers.image.description=${{ env.LABEL_IMAGE_DESCRIPTION }}
org.opencontainers.image.authors=${{ env.LABEL_IMAGE_AUTHORS }}
org.opencontainers.image.documentation=${{ env.LABEL_IMAGE_DOCUMENTATION }}
org.opencontainers.image.vendor=${{ env.LABEL_IMAGE_VENDOR }}
org.opencontainers.image.licenses=${{ env.LABEL_IMAGE_LICENSE }}
org.opencontainers.image.url=${{ env.LABEL_IMAGE_URL }}
org.opencontainers.image.version=${{ github.event.release.tag_name }}
- name: Build ${{ env.IMAGE_NAME }}
id: build
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ env.PLATFORMS }}
push: ${{ github.event.release.prerelease == false }} # only push on final release
file: docker/Dockerfile
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
github-token: ${{ secrets.GITHUB_TOKEN }}
build-args: |
hash=${{ github.sha }}
version=${{ github.event.release.tag_name }}