Skip to content

Update main.yml

Update main.yml #401

Workflow file for this run

name: Push wiremock releases
on:
schedule:
- cron: '0 0 15 * *'
push:
workflow_dispatch:
jobs:
checkout:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
generate-matrix:
runs-on: ubuntu-latest
steps:
- name: Set matrix for build
id: set-matrix
run: |
RELEASES=$(curl -s -H "Accept: application/vnd.github.v3+json" -X GET "https://api.github.com/repos/wiremock/wiremock-docker/tags?per_page=5" | jq --compact-output '[ .[] | select(.name|match("[0-9].[0-9]+.[0-9]$")) | .name ]')
echo "::set-output name=matrix::$RELEASES"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
get-latest-release:
runs-on: ubuntu-latest
steps:
- name: Set latest release for build
id: set-latest-release
run: |
RELEASES=$(curl -s -H "Accept: application/vnd.github.v3+json" -X GET "https://api.github.com/repos/wiremock/wiremock-docker/tags?per_page=20" | jq --compact-output '[ .[] | select(.name|match("[0-9].[0-9]+.[0-9]$")) | .name ]')
RELEASE=$(echo ${RELEASES} | jq -r --slurp '.[0][0]')
echo "::set-output name=release::$RELEASE"
outputs:
release: ${{ steps.set-latest-release.outputs.release }}
build-n-push:
needs: generate-matrix
runs-on: ubuntu-latest
strategy:
matrix:
releases: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- name: debug
run: |
echo "building and pushing ${{ matrix.releases }}"
- name: Build docker images with tags
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./docker
push: true
tags: rbillon59/wiremock-loadtest:${{ matrix.releases }}
build-args: WIREMOCK_VERSION=${{ matrix.releases }}
platforms: linux/amd64,linux/arm64
build-n-push-latest:
needs: get-latest-release
runs-on: ubuntu-latest
steps:
- name: debug
run: |
echo "building and pushing ${{ needs.get-latest-release.outputs.release }}"
- name: Build docker images with tags
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./docker
push: true
tags: rbillon59/wiremock-loadtest:latest
build-args: WIREMOCK_VERSION=${{ needs.get-latest-release.outputs.release }}
platforms: linux/amd64,linux/arm64