fix: official derp map #14
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Run tests | |
| run: make test | |
| build-and-push: | |
| name: Build ${{ matrix.platform }} | |
| needs: test | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: linux/amd64 | |
| runner: ubuntu-24.04 | |
| arch: amd64 | |
| - platform: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| arch: arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set image name to lowercase | |
| id: image | |
| run: echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ steps.image.outputs.name }} | |
| tags: | | |
| type=semver,pattern=v{{version}} | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=sha | |
| - name: Build and push Docker image | |
| id: build | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: ${{ matrix.platform }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| outputs: type=image,name=${{ env.REGISTRY }}/${{ steps.image.outputs.name }},push-by-digest=true,name-canonical=true,push=true | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max,scope=${{ matrix.arch }} | |
| - name: Export image digest | |
| run: | | |
| mkdir -p /tmp/digests | |
| digest="${{ steps.build.outputs.digest }}" | |
| touch "/tmp/digests/${digest#sha256:}" | |
| - name: Upload image digest | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: digests-${{ matrix.arch }} | |
| path: /tmp/digests/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| merge-image: | |
| name: Merge Multi-Platform Image | |
| runs-on: ubuntu-24.04 | |
| needs: build-and-push | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Set image name to lowercase | |
| id: image | |
| run: echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT | |
| - name: Download image digests | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: /tmp/digests | |
| pattern: digests-* | |
| merge-multiple: true | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ steps.image.outputs.name }} | |
| tags: | | |
| type=semver,pattern=v{{version}} | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=sha | |
| - name: Create multi-platform manifest | |
| env: | |
| IMAGE_NAME: ${{ env.REGISTRY }}/${{ steps.image.outputs.name }} | |
| IMAGE_TAGS: ${{ steps.meta.outputs.tags }} | |
| run: | | |
| tag_args=() | |
| while IFS= read -r tag; do | |
| tag_args+=(--tag "$tag") | |
| done <<< "$IMAGE_TAGS" | |
| source_args=() | |
| for digest in /tmp/digests/*; do | |
| source_args+=("$IMAGE_NAME@sha256:$(basename "$digest")") | |
| done | |
| docker buildx imagetools create "${tag_args[@]}" "${source_args[@]}" | |
| - name: Inspect multi-platform image | |
| env: | |
| VERSION_TAG: ${{ env.REGISTRY }}/${{ steps.image.outputs.name }}:${{ github.ref_name }} | |
| run: docker buildx imagetools inspect "$VERSION_TAG" | |
| release-manifests: | |
| name: Generate Release Manifests | |
| runs-on: ubuntu-latest | |
| needs: merge-image | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set image name to lowercase | |
| id: image | |
| run: echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Setup Helm | |
| uses: azure/setup-helm@v4 | |
| - name: Generate install manifests | |
| run: | | |
| make build-installer IMG=${{ env.REGISTRY }}/${{ steps.image.outputs.name }}:${{ github.ref_name }} | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| helm package dist/chart --destination dist --version "$VERSION" --app-version "$VERSION" | |
| - name: Upload Release Assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| dist/install.yaml | |
| dist/kodiak-*.tgz | |
| generate_release_notes: true |