v1.13.0 #838
Workflow file for this run
This file contains 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 | |
on: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- '**/README.md' | |
- '.github/workflows/weekly-fuzz.yml' | |
- 'docs/**' | |
release: | |
types: [ published ] | |
workflow_dispatch: | |
inputs: | |
docker_tag: | |
description: 'value to use for override the image tag; <tag> will still be used for checkout' | |
required: false | |
tag: | |
description: 'git tag to checkout' | |
required: true | |
# default: '' | |
jobs: | |
build: | |
name: build and test container image | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: 'wait for tests' | |
uses: lewagon/wait-on-check-action@v1.3.3 | |
with: | |
ref: ${{ github.ref }} | |
check-name: 'go test & build' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
wait-interval: 10 | |
- name: checkout | |
uses: actions/checkout@v4 | |
if: github.event_name != 'workflow_dispatch' | |
- name: checkout given tag | |
uses: actions/checkout@v4 | |
if: github.event_name == 'workflow_dispatch' | |
with: | |
ref: ${{ github.event.inputs.tag }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build and load docker image | |
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' || (github.ref == 'refs/heads/master' && github.event_name == 'push') | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
load: true | |
tags: 'couper-test-${{ github.ref }}' | |
- name: Test container serves index.html | |
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' || (github.ref == 'refs/heads/master' && github.event_name == 'push') | |
run: | | |
docker run -d --rm -p 8080:8080 'couper-test-${{ github.ref }}' | |
[[ $(curl --head --location --connect-timeout 5 --write-out %{http_code} --silent --output /dev/null http://localhost:8080/) == 200 ]] | |
publish: | |
needs: build | |
name: build and publish container image | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
include: | |
- image: 'coupergateway/couper' | |
username_key: DOCKER_COUPER_GATEWAY_USERNAME | |
password_key: DOCKER_COUPER_GATEWAY_PASSWORD | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
if: github.event_name != 'workflow_dispatch' | |
- name: checkout given tag | |
uses: actions/checkout@v4 | |
if: github.event_name == 'workflow_dispatch' | |
with: | |
ref: 'refs/tags/${{ github.event.inputs.tag }}' | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: | | |
${{ matrix.image }} | |
tags: | | |
type=semver,pattern={{major}}.{{minor}}.{{patch}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}}.{{minor}}.{{patch}},value=${{ github.event.inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.docker_tag == '' }} | |
type=semver,pattern={{major}}.{{minor}},value=${{ github.event.inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.docker_tag == '' }} | |
type=edge,branch=master,event=branch,enable=${{ github.event_name != 'workflow_dispatch' }} | |
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.docker_tag != '' }},value=${{ github.event.inputs.docker_tag }} | |
- 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 | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
#registry: ... | |
username: ${{ secrets[matrix.username_key] }} | |
password: ${{ secrets[matrix.password_key] }} | |
- name: Build & push image with edge tag | |
if: github.ref == 'refs/heads/master' && github.event_name == 'push' # due to release branch, pin to master | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
labels: ${{ steps.meta.outputs.labels }} | |
tags: ${{ steps.meta.outputs.tags }} | |
push: ${{ GitHub.event_name != 'pull_request' }} | |
- name: Build & push image with specific tag | |
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
labels: ${{ steps.meta.outputs.labels }} | |
tags: ${{ steps.meta.outputs.tags }} | |
push: ${{ GitHub.event_name != 'pull_request' }} | |
- name: Docker Hub Description | |
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.docker_tag == '') | |
uses: peter-evans/dockerhub-description@v2 | |
with: | |
readme-filepath: './DOCKER.md' | |
username: ${{ secrets[matrix.username_key] }} | |
password: ${{ secrets[matrix.password_key] }} | |
repository: ${{ matrix.image }} | |
oidc: | |
name: trigger couper-oidc-gateway edge build | |
needs: publish | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
steps: | |
- run: | | |
curl \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GH_COUPER_API_TOKEN }}" \ | |
https://api.github.com/repos/coupergateway/couper-oidc-gateway/dispatches \ | |
-d '{"event_type": "edge-build", "client_payload": { "version": "edge" }}' |