docker-nginx-h5ai/.gitea/workflows/build.yaml

153 lines
6.8 KiB
YAML

name: Build Container Image
run-name: ${{ gitea.actor }} pushed to ${{ gitea.repository }}:${{ gitea.ref_name }}
on:
push:
schedule:
- cron: '0 18 * * 5'
jobs:
build_amd64:
if: gitea.repository_owner == 'NephNET' && (!contains(gitea.event.head_commit.message, '#noci') || gitea.event_name == 'schedule')
runs-on: nephnet-amd64
steps:
- name: Checkout Repository
uses: https://gitea.com/actions/checkout@v3
- name: Docker Build
run: |
export BRANCH=${GITHUB_REF##*/}
export BRANCH=${BRANCH:-master}
docker build --pull -t code.nephatrine.net/nephnet/nginx-h5ai:${BRANCH}-cached --target builder ${{ gitea.workspace }}
docker build --pull -t code.nephatrine.net/nephnet/nginx-h5ai:${BRANCH}-amd64 ${{ gitea.workspace }}
- name: Docker Login
uses: https://github.com/docker/login-action@v3
with:
registry: code.nephatrine.net
username: ${{ gitea.actor }}
password: ${{ secrets.PACKAGER_TOKEN }}
- name: Docker Push
run: |
export BRANCH=${GITHUB_REF##*/}
export BRANCH=${BRANCH:-master}
docker push code.nephatrine.net/nephnet/nginx-h5ai:${BRANCH}-amd64
- name: Notify Discord
uses: https://github.com/sarisia/actions-status-discord@v1
if: always()
with:
title: "Container Build (X86_64)"
webhook: ${{ secrets.DISCORD_WEBHOOK_BUILD }}
build_arm64:
if: gitea.repository_owner == 'NephNET' && (!contains(gitea.event.head_commit.message, '#noci') || gitea.event_name == 'schedule')
runs-on: nephnet-arm64
steps:
- name: Checkout Repository
uses: https://gitea.com/actions/checkout@v3
- name: Docker Build
run: |
export BRANCH=${GITHUB_REF##*/}
export BRANCH=${BRANCH:-master}
docker build --pull -t code.nephatrine.net/nephnet/nginx-h5ai:${BRANCH}-cached --target builder ${{ gitea.workspace }}
docker build --pull -t code.nephatrine.net/nephnet/nginx-h5ai:${BRANCH}-arm64v8 ${{ gitea.workspace }}
- name: Docker Login
uses: https://github.com/docker/login-action@v3
with:
registry: code.nephatrine.net
username: ${{ gitea.actor }}
password: ${{ secrets.PACKAGER_TOKEN }}
- name: Docker Push
run: |
export BRANCH=${GITHUB_REF##*/}
export BRANCH=${BRANCH:-master}
docker push code.nephatrine.net/nephnet/nginx-h5ai:${BRANCH}-arm64v8
- name: Notify Discord
uses: https://github.com/sarisia/actions-status-discord@v1
if: always()
with:
title: "Container Build (AARCH64)"
webhook: ${{ secrets.DISCORD_WEBHOOK_BUILD }}
build_manifest:
needs: [build_amd64, build_arm64]
runs-on: nephnet
steps:
- name: Docker Login
uses: https://github.com/docker/login-action@v3
with:
registry: code.nephatrine.net
username: ${{ gitea.actor }}
password: ${{ secrets.PACKAGER_TOKEN }}
- name: Docker Manifest
run: |
export BRANCH=${GITHUB_REF##*/}
export BRANCH=${BRANCH:-master}
docker manifest create code.nephatrine.net/nephnet/nginx-h5ai:${BRANCH} --amend code.nephatrine.net/nephnet/nginx-h5ai:${BRANCH}-amd64 --amend code.nephatrine.net/nephnet/nginx-h5ai:${BRANCH}-arm64v8
docker manifest push --purge code.nephatrine.net/nephnet/nginx-h5ai:${BRANCH}
publish_amd64:
if: gitea.ref_name == 'master' || gitea.ref_name == ''
needs: [build_amd64]
runs-on: nephnet-amd64
steps:
- name: Docker Login
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Docker Push
run: |
docker tag code.nephatrine.net/nephnet/nginx-h5ai:master-amd64 nephatrine/nginx-h5ai:latest-amd64
docker push nephatrine/nginx-h5ai:latest-amd64
publish_arm64:
if: gitea.ref_name == 'master' || gitea.ref_name == ''
needs: [build_arm64]
runs-on: nephnet-arm64
steps:
- name: Docker Login
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Docker Push
run: |
docker tag code.nephatrine.net/nephnet/nginx-h5ai:master-arm64v8 nephatrine/nginx-h5ai:latest-arm64v8
docker push nephatrine/nginx-h5ai:latest-arm64v8
publish_manifest:
needs: [publish_amd64, publish_arm64]
runs-on: nephnet
steps:
- name: Check Base Image
if: gitea.event_name == 'schedule'
uses: https://github.com/lucacome/docker-image-update-checker@v1
id: checkbase
with:
base-image: nephatrine/nginx-php:latest
image: nephatrine/nginx-h5ai:latest
platforms: linux/amd64
- name: Docker Login
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Docker Manifest
run: |
docker manifest create nephatrine/nginx-h5ai:0.31.0 --amend nephatrine/nginx-h5ai:latest-amd64 --amend nephatrine/nginx-h5ai:latest-arm64v8
docker manifest create nephatrine/nginx-h5ai:0.31 --amend nephatrine/nginx-h5ai:latest-amd64 --amend nephatrine/nginx-h5ai:latest-arm64v8
docker manifest create nephatrine/nginx-h5ai:0 --amend nephatrine/nginx-h5ai:latest-amd64 --amend nephatrine/nginx-h5ai:latest-arm64v8
docker manifest create nephatrine/nginx-h5ai:latest --amend nephatrine/nginx-h5ai:latest-amd64 --amend nephatrine/nginx-h5ai:latest-arm64v8
docker manifest push --purge nephatrine/nginx-h5ai:0.31.0
docker manifest push --purge nephatrine/nginx-h5ai:0.31
docker manifest push --purge nephatrine/nginx-h5ai:0
docker manifest push --purge nephatrine/nginx-h5ai:latest
- name: Notify Discord
if: gitea.event_name != 'schedule' || steps.checkbase.outputs.needs-updating == 'true'
uses: https://github.com/sarisia/actions-status-discord@v1
with:
title: "DockerHub: nginx-h5ai"
description: "The container image was pushed to [DockerHub](https://hub.docker.com/repository/docker/nephatrine/nginx-h5ai/general).\nPull `nephatrine/nginx-h5ai:latest` for the newest image."
nodetail: true
webhook: ${{ secrets.DISCORD_WEBHOOK_PACKAGE }}
- name: Checkout Repository
uses: https://gitea.com/actions/checkout@v3
- name: Docker Describe
uses: https://github.com/peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
repository: nephatrine/nginx-h5ai