Release 4.x Beta #12
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 4.x Beta | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Image version (single-digit suffix like 4.0.0-beta.29-1)' | |
| required: true | |
| default: 1 | |
| bundled-version: | |
| description: 'Bundled WireMock version' | |
| required: true | |
| default: 4.0.0-beta.29 | |
| jobs: | |
| check-new-version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| new_version: ${{ steps.new_version.outputs.NEW_VERSION }} | |
| steps: | |
| - name: Release if newer version | |
| id: new_version | |
| run: | | |
| CURRENT_VERSION=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/wiremock/wiremock-docker.git '4.*.*' | tail -1 | cut -d '/' -f3) | |
| CURRENT_VERSION=${CURRENT_VERSION%-*} | |
| LATEST_VERSION=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/wiremock/wiremock.git '4.*.*' | tail -1 | cut -d '/' -f3) | |
| echo "NEW_VERSION=${{ github.event.inputs.bundled-version }}-${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| verify-container-startup: | |
| runs-on: ubuntu-latest | |
| needs: [check-new-version] | |
| if: needs.check-new-version.outputs.new_version | |
| steps: | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Checkout sources | |
| uses: actions/checkout@main | |
| - name: Build WireMock Docker image (local) | |
| run: | | |
| docker buildx build \ | |
| --tag wiremock/wiremock:verify \ | |
| --load \ | |
| --build-arg "WIREMOCK_VERSION=${{ github.event.inputs.bundled-version }}" \ | |
| --build-arg "JAVA_VERSION=17" \ | |
| --file Dockerfile \ | |
| . | |
| - name: Verify container startup | |
| run: | | |
| docker run -d --name wiremock-test -p 8080:8080 wiremock/wiremock:verify | |
| timeout 30 bash -c 'until curl -sf http://localhost:8080/__admin/health; do sleep 1; done' | |
| echo "WireMock container started and health check passed" | |
| docker stop wiremock-test | |
| docker rm wiremock-test | |
| docker-build-push: | |
| runs-on: ubuntu-latest | |
| needs: [check-new-version, verify-container-startup] | |
| if: needs.check-new-version.outputs.new_version | |
| strategy: | |
| matrix: | |
| versions: | |
| - CONTEXT: . | |
| IMAGES: | |
| - wiremock/wiremock:4x-beta | |
| - wiremock/wiremock:${{ needs.check-new-version.outputs.new_version }} | |
| - wiremock/wiremock:${{ github.event.inputs.bundled-version }} | |
| - ghcr.io/wiremock/wiremock:4x-beta | |
| - ghcr.io/wiremock/wiremock:${{ needs.check-new-version.outputs.new_version }} | |
| - ghcr.io/wiremock/wiremock:${{ github.event.inputs.bundled-version }} | |
| PLATFORMS: | |
| - linux/amd64 | |
| - linux/arm64 | |
| - linux/arm/v7 | |
| - CONTEXT: alpine | |
| IMAGES: | |
| - wiremock/wiremock:4x-beta-alpine | |
| - wiremock/wiremock:${{ needs.check-new-version.outputs.new_version }}-alpine | |
| - wiremock/wiremock:${{ github.event.inputs.bundled-version }}-alpine | |
| - ghcr.io/wiremock/wiremock:4x-beta-alpine | |
| - ghcr.io/wiremock/wiremock:${{ needs.check-new-version.outputs.new_version }}-alpine | |
| - ghcr.io/wiremock/wiremock:${{ github.event.inputs.bundled-version }}-alpine | |
| PLATFORMS: | |
| - linux/amd64 | |
| steps: | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| if: ${{ matrix.versions.CONTEXT != 'alpine' }} | |
| with: | |
| image: tonistiigi/binfmt:latest | |
| platforms: all | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Checkout sources | |
| uses: actions/checkout@main | |
| with: | |
| fetch-depth: 0 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: wiremockio | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: wiremock | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Push WireMock Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ${{ matrix.versions.CONTEXT }} | |
| platforms: ${{ join(matrix.versions.PLATFORMS, ',') }} | |
| push: true | |
| tags: ${{ join(matrix.versions.IMAGES, ',') }} | |
| build-args: | | |
| WIREMOCK_VERSION=${{ github.event.inputs.bundled-version }} | |
| JAVA_VERSION=17 | |
| container-image-scan: | |
| uses: ./.github/workflows/container-image-scan.yml | |
| needs: [check-new-version, docker-build-push] | |
| if: needs.check-new-version.outputs.new_version | |
| with: | |
| image_version: ${{ needs.check-new-version.outputs.new_version }} | |
| secrets: inherit | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: [docker-build-push, check-new-version] | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@main | |
| with: | |
| fetch-depth: 0 | |
| - name: Update version | |
| run: | | |
| # Replace version in Dockerfiles | |
| sed -i 's/ARG WIREMOCK_VERSION=.*/ARG WIREMOCK_VERSION=${{ github.event.inputs.bundled-version }}/g' Dockerfile alpine/Dockerfile | |
| # Push update | |
| git config --local user.name "wiremockio" | |
| git config --local user.email "release-bot@wiremock.org" | |
| git add . | |
| git commit -m "upgrade to version ${{ needs.check-new-version.outputs.new_version }}" || echo "No changes to commit" | |
| git remote set-url origin https://${{ secrets.GITHUB_TOKEN }}@github.com/wiremock/wiremock-docker.git | |
| git push origin main | |
| - name: Release | |
| uses: softprops/action-gh-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ needs.check-new-version.outputs.new_version }} | |
| prerelease: true |