Initial commit #13
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: Publish Docker branch image (edge) | |
on: | |
schedule: | |
- cron: '0 0 * * *' # At 00:00 | |
push: | |
branches: | |
- main | |
paths: | |
# Workflow file itself | |
- '.github/workflows/deploy_edge.yml' | |
# Dockerfile | |
- '*.dockerfile' | |
workflow_dispatch: | |
permissions: | |
packages: write | |
contents: read | |
jobs: | |
build_image: | |
name: Build Docker image (${{ matrix.project }}-edge) (${{ matrix.platform }}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
project: | |
- "clang" | |
- "clang-tidy" | |
- "clang-format" | |
- "llvm-bolt" | |
platform: | |
- "linux/amd64" | |
- "linux/i386" | |
- "linux/arm64" | |
- "linux/arm" | |
exclude: | |
# llvm-bolt cannot be built on i386 | |
- project: llvm-bolt | |
platform: linux/i386 | |
steps: | |
- name: Check out the repo | |
uses: actions/[email protected] | |
- name: Docker Setup QEMU | |
uses: docker/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Docker meta | |
id: meta | |
uses: docker/[email protected] | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
ams21/${{ matrix.project }} | |
ghcr.io/ams21/${{ matrix.project }} | |
flavor: | | |
latest=false | |
prefix= | |
suffix= | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=raw,value=edge-${{ matrix.platform }} | |
- name: Build Docker image | |
uses: docker/[email protected] | |
with: | |
context: ./ | |
file: ${{ matrix.project }}.dockerfile | |
build-args: "VERSION=main" | |
push: false | |
platforms: ${{ matrix.platform }} | |
annotations: ${{ steps.meta.outputs.annotations }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Upload image | |
uses: ishworkh/[email protected] | |
with: | |
image: "ams21/${{ matrix.project }}:edge-${{ matrix.platform }}" | |
deploy: | |
name: Deploy | |
needs: build_image | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
project: | |
- "clang" | |
- "clang-tidy" | |
- "clang-format" | |
- "llvm-bolt" | |
steps: | |
# Download images | |
- name: Download image linux/amd64 | |
uses: ishworkh/[email protected] | |
with: | |
image: "ams21/${{ matrix.project }}:edge-linux/amd64" | |
- name: Download image linux/i386 | |
if: matrix.project != 'llvm-bolt' | |
uses: ishworkh/[email protected] | |
with: | |
image: "ams21/${{ matrix.project }}:edge-linux/i386" | |
- name: Download image linux/arm64 | |
uses: ishworkh/[email protected] | |
with: | |
image: "ams21/${{ matrix.project }}:edge-linux/arm64" | |
- name: Download image linux/arm | |
uses: ishworkh/[email protected] | |
with: | |
image: "ams21/${{ matrix.project }}:edge-linux/arm" | |
- name: Log in to Docker Hub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: docker-manifest-action | |
if: matrix.project != 'llvm-bolt' | |
uses: Noelware/[email protected] | |
with: | |
inputs: ams21/${{ matrix.project }}:edge | |
images: ams21/${{ matrix.project }}:edge-linux/amd64,ams21/${{ matrix.project }}:edge-linux/i386,ams21/${{ matrix.project }}:edge-linux/arm64,ams21/${{ matrix.project }}:edge-linux/arm | |
push: true | |
- name: docker-manifest-action | |
if: matrix.project == 'llvm-bolt' | |
uses: Noelware/[email protected] | |
with: | |
inputs: ams21/${{ matrix.project }}:edge | |
images: ams21/${{ matrix.project }}:edge-linux/amd64,ams21/${{ matrix.project }}:edge-linux/arm64,ams21/${{ matrix.project }}:edge-linux/arm | |
push: true |