Skip to content

Continuous Integration #851

Continuous Integration

Continuous Integration #851

Workflow file for this run

name: Continuous Integration
on:
push:
schedule:
- cron: '0 17 * * *' # 3 AM AEST
jobs:
image:
runs-on:
- ${{ matrix.arch }}
- linux
- self-hosted
steps:
- uses: actions/[email protected]
- uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/[email protected]
with:
context: . # See: https://github.com/docker/build-push-action/issues/182#issuecomment-814589666
file: ${{ matrix.os }}/Dockerfile
no-cache: ${{ github.event_name == 'schedule' }}
push: true
tags: ${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPO }}:sha-${{ github.sha }}-${{ matrix.os }}-${{ matrix.arch }}
strategy:
matrix:
arch:
- arm64
- x64
os:
- bionic
- focal
- jammy
manifest:
env:
IMAGE_REPO: ${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPO }}
IMAGE_TAG: sha-${{ github.sha }}-${{ matrix.os }}
needs: image
runs-on:
- linux
- self-hosted
steps:
- uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push branch manifest list
run: |
docker buildx imagetools create -t \
${{ env.IMAGE_REPO }}:${GITHUB_REF#refs/heads/}-${{ matrix.os }} \
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}-arm64 \
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}-x64
- name: Push SHA manifest list
run: |
docker buildx imagetools create -t \
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} \
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}-arm64 \
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}-x64
- name: Push OS manifest list
if: github.ref == 'refs/heads/master'
run: |
# Latest.
docker buildx imagetools create -t \
${{ env.IMAGE_REPO }}:${{ matrix.os }} \
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}-arm64 \
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}-x64
- name: Push 'latest' manifest list
if: github.ref == 'refs/heads/master' && matrix.os == 'focal'
run: |
# Latest.
docker buildx imagetools create -t \
${{ env.IMAGE_REPO }}:latest \
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}-arm64 \
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}-x64
- name: Remove arch tags
run: |
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "${{ secrets.DOCKER_USERNAME }}", "password": "${{ secrets.DOCKER_PASSWORD }}"}' "https://hub.docker.com/v2/users/login/" | jq -r '.token')
curl "https://hub.docker.com/v2/repositories/${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPO }}/tags/${{ env.IMAGE_TAG }}-arm64/" -X DELETE -H "Authorization: JWT ${TOKEN}"
curl "https://hub.docker.com/v2/repositories/${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPO }}/tags/${{ env.IMAGE_TAG }}-x64/" -X DELETE -H "Authorization: JWT ${TOKEN}"
strategy:
matrix:
os:
- bionic
- focal
- jammy
readme:
needs: manifest
runs-on:
- self-hosted
steps:
- uses: actions/[email protected]
- uses: peter-evans/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPO }}