Skip to content

Release 0.1.2 by strokyl #22

Release 0.1.2 by strokyl

Release 0.1.2 by strokyl #22

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/cmd.version=${{ github.event.release.tag_name }}' -X 'github.com/conduktor/ctl/cmd.hash=${{ github.sha }}'
project_path: "./"
binary_name: "conduktor"
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 }}