Kanvas Docker Extension v0.8.1 #18
Workflow file for this run
This file contains hidden or 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: Docker Extension for Kanvas | |
| on: | |
| release: | |
| types: [published] # Runs only when a new release is published | |
| env: | |
| GIT_TAG: ${{ github.event.release.tag_name }} | |
| jobs: | |
| derive-version-info: | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| GIT_VERSION: ${{ steps.set-vars.outputs.GIT_VERSION }} | |
| GIT_STRIPPED_VERSION: ${{ steps.set-vars.outputs.GIT_STRIPPED_VERSION }} | |
| RELEASE_CHANNEL: ${{ steps.set-vars.outputs.RELEASE_CHANNEL }} | |
| steps: | |
| - name: Set version variables from tag | |
| id: set-vars | |
| run: | | |
| TAG_NAME="${{ github.event.release.tag_name }}" | |
| echo "Detected tag: $TAG_NAME" | |
| # Strip 'v' from version tag if it exists | |
| STRIPPED_VERSION="${TAG_NAME#v}" | |
| # Use 'stable' if it's a tagged release, else fallback to 'edge' | |
| if [[ "$TAG_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then | |
| CHANNEL="stable" | |
| else | |
| CHANNEL="edge" | |
| fi | |
| echo "GIT_VERSION=$TAG_NAME" >> $GITHUB_OUTPUT | |
| echo "GIT_STRIPPED_VERSION=$STRIPPED_VERSION" >> $GITHUB_OUTPUT | |
| echo "RELEASE_CHANNEL=$CHANNEL" >> $GITHUB_OUTPUT | |
| docker-extension: | |
| needs: derive-version-info | |
| runs-on: ubuntu-24.04 | |
| env: | |
| GIT_VERSION: ${{ needs.derive-version-info.outputs.GIT_VERSION }} | |
| GIT_STRIPPED_VERSION: ${{ needs.derive-version-info.outputs.GIT_STRIPPED_VERSION }} | |
| RELEASE_CHANNEL: ${{ needs.derive-version-info.outputs.RELEASE_CHANNEL }} | |
| steps: | |
| - name: Checkout 🛎️ repo | |
| uses: actions/checkout@v4 | |
| - name: Generate release notes | |
| id: release_notes | |
| run: | | |
| RELEASE_NOTES=$(gh release create ${{ github.ref_name }} --generate-notes --repo ${{ github.repository }} | tail -n +2) # Get generated release notes, excluding the first line | |
| echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV | |
| echo "$RELEASE_NOTES" >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Docker Meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: layer5/kanvas-docker-extension | |
| flavor: | | |
| latest=true | |
| tags: | | |
| type=raw,value=${{env.RELEASE_CHANNEL}}-{{sha}} | |
| type=semver,pattern={{version}},value=${{env.GIT_STRIPPED_VERSION}} | |
| type=raw,value=${{env.RELEASE_CHANNEL}}-{{tag}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
| type=raw,value=${{env.RELEASE_CHANNEL}}-latest | |
| type=raw,value=${{env.RELEASE_CHANNEL}}-${{env.GIT_VERSION}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and Push Docker Extension | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: "{{defaultContext}}" | |
| push: true | |
| build-args: | | |
| GIT_STRIPPED_VERSION=${{env.GIT_STRIPPED_VERSION}} | |
| GIT_VERSION=${{env.GIT_VERSION}} | |
| RELEASE_CHANNEL=${{env.RELEASE_CHANNEL}} | |
| RELEASE_NOTES=${{ env.RELEASE_NOTES }} | |
| tags: ${{ steps.meta.outputs.tags }}, ${{ github.ref_name }} | |
| platforms: linux/amd64,linux/arm64 |