improve artifact #4
Workflow file for this run
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 | ||
run-name: Release ${{ github.event.release.tag_name }} by ${{ github.actor }} | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
tags: | ||
name: List tags to be created | ||
runs-on: cdk-standard | ||
outputs: | ||
image_tags: ${{ steps.image_tag.outputs.tags }} | ||
version: ${{ steps.image_tag.outputs.version }} | ||
is_latest: ${{ steps.image_tag.outputs.is_latest }} | ||
steps: | ||
- name: Debug tags | ||
shell: bash | ||
run: | | ||
echo "----------------------------" | ||
echo "GITHUB_REF : ${GITHUB_REF}" | ||
echo "GITHUB_REF_NAME: ${GITHUB_REF_NAME}" | ||
echo "GITHUB_REF_TYPE : ${GITHUB_REF_TYPE}" | ||
echo "----------------------------" | ||
echo "Release event : " | ||
echo " name :${{ github.event.release.name }}" | ||
echo " tag_name :${{ github.event.release.tag_name }}" | ||
echo " target_commitish:${{ github.event.release.target_commitish }}" | ||
echo " draft:${{ github.event.release.draft }}" | ||
- name: Parse version from tag | ||
id: version | ||
uses: release-kit/semver@v2 | ||
with: | ||
string: '${{ github.event.release.tag_name }}' | ||
- name: Set release tag | ||
if: ${{ github.event.release }} | ||
shell: bash | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
latest_release_version=$(gh release view -R ${{ github.repository }} --json tagName -q .tagName) | ||
echo "Latest release is ${latest_release}" | ||
is_latest=$(test "${{ github.event.release.tag_name }}" == "${latest_release_version}" && echo true || echo false) | ||
echo "RELEASE_TAG=${{ steps.version.outputs.full }}" >> $GITHUB_ENV | ||
echo "IS_LATEST=${is_latest}" >> $GITHUB_ENV | ||
- name: Image tag | ||
id: image_tag | ||
shell: bash | ||
run: | | ||
TAGS="" | ||
TAGS="${TAGS}type=raw,value=${{ steps.version.outputs.full }}\n" | ||
TAGS="${TAGS}type=semver,pattern={{version}}\n" | ||
TAGS="${TAGS}type=raw,value=latest,enable=${{ env.IS_LATEST }}\n" | ||
delimiter="$(openssl rand -hex 8)" | ||
echo -e "tags<<${delimiter}\n${TAGS}\n${delimiter}" >> "${GITHUB_OUTPUT}" | ||
echo -e "version=${{ steps.version.outputs.full }}" >> "${GITHUB_OUTPUT}" | ||
echo -e "is_latest=${{ env.IS_LATEST }}" >> "${GITHUB_OUTPUT}" | ||
echo "Outputs ${GITHUB_OUTPUT}" | ||
echo "-------" | ||
cat "${GITHUB_OUTPUT}" | ||
echo "-------" | ||
unit-test: | ||
runs-on: cdk-standard | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.22.0 | ||
- name: go test | ||
run: go test ./... | ||
integration-test: | ||
runs-on: cdk-standard | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: run test | ||
run: ./test_final_exec.sh | ||
build-exec: | ||
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] | ||
needs: [unit-test, integration-test] | ||
name: Build exec | ||
- uses: wangyoucao577/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
goos: ${{ matrix.goos }} | ||
goarch: ${{ matrix.goarch }} | ||
goversion: "1.22.0" | ||
project_path: "./" | ||
binary_name: "conduktor" | ||
build-docker: | ||
name: Build and publish conduktorctl images | ||
uses: ./.github/workflows/build-docker.yml | ||
secrets: inherit | ||
needs: [tags, unit-test, integration-test] | ||
with: | ||
release: true | ||
push: true | ||
image_tags: ${{ needs.tags.outputs.image_tags }} |