feat: reject version aliases that name the wrong engine line #1269
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: CI | |
| on: | |
| - push | |
| - pull_request | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest-l | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Setup Go | |
| uses: actions/setup-go@v7 | |
| with: | |
| go-version: '1.25.0' | |
| - name: Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '11.0.20' | |
| distribution: 'temurin' | |
| - name: Install dependencies | |
| run: go mod download | |
| - name: Test | |
| run: go test -v ./... | |
| - name: Build | |
| run: go build | |
| docker-build: | |
| needs: build | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/v')) | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: linux/amd64 | |
| runner: ubuntu-latest | |
| - platform: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v4.6.0 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_TOKEN }} | |
| - name: Set version | |
| id: tag | |
| run: | | |
| if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then | |
| echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "version=beta" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Build and push by digest | |
| id: build | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| platforms: ${{ matrix.platform }} | |
| build-args: | | |
| VERSION=${{ steps.tag.outputs.version }} | |
| outputs: type=image,name=impostermocks/cli,push-by-digest=true,name-canonical=true,push=true | |
| - name: Export digest | |
| run: | | |
| mkdir -p /tmp/digests | |
| digest="${{ steps.build.outputs.digest }}" | |
| touch "/tmp/digests/${digest#sha256:}" | |
| - name: Upload digest | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: digests-${{ matrix.runner }} | |
| path: /tmp/digests/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| docker-manifest: | |
| needs: docker-build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Download digests | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: /tmp/digests | |
| pattern: digests-* | |
| merge-multiple: true | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v4.6.0 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_TOKEN }} | |
| - name: Set Docker tags | |
| id: tag | |
| run: | | |
| if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| echo "tags=impostermocks/cli:${VERSION},impostermocks/cli:latest" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "tags=impostermocks/cli:beta" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Create manifest list and push | |
| working-directory: /tmp/digests | |
| run: | | |
| TAGARGS=$(echo "${{ steps.tag.outputs.tags }}" | tr ',' '\n' | xargs -I{} echo "-t {}" | tr '\n' ' ') | |
| docker buildx imagetools create $TAGARGS \ | |
| $(printf 'impostermocks/cli@sha256:%s ' *) | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest-l | |
| permissions: | |
| contents: read | |
| packages: write | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Go | |
| uses: actions/setup-go@v7 | |
| with: | |
| go-version: '1.25.0' | |
| - name: Dry run | |
| uses: goreleaser/goreleaser-action@v7 | |
| if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| with: | |
| version: latest | |
| args: release --snapshot | |
| - name: Release | |
| uses: goreleaser/goreleaser-action@v7 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| version: latest | |
| args: release --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} |