refactor: rewrite ci workflows

This commit is contained in:
Daniel Wolf 2024-03-26 18:57:56 -04:00
parent 6ecfe12de1
commit ff302dc5f0
Signed by: nephatrine
GPG Key ID: 59D70EC2E4AAB4D0
3 changed files with 108 additions and 37 deletions

View File

@ -9,9 +9,10 @@ on:
schedule:
- cron: '20 20 * * 2'
jobs:
build_amd64:
if: gitea.repository_owner == 'NephNET' && (!contains(gitea.event.head_commit.message, '#noci') || gitea.event_name == 'schedule')
build_latest_amd64:
if: gitea.repository_owner == 'NephNET' && (!(startsWith(gitea.event.head_commit.message, 'chore') || startsWith(gitea.event.head_commit.message, 'docs')) || gitea.event_name == 'schedule')
runs-on: nephnet-amd64
continue-on-error: true
steps:
- name: Checkout Repository
uses: https://gitea.com/actions/checkout@v4
@ -24,6 +25,11 @@ jobs:
registry: code.nephatrine.net
username: ${{ gitea.actor }}
password: ${{ secrets.PACKAGER_TOKEN }}
- name: Docker Login (Pull Auth)
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build & Push (Master)
uses: https://github.com/docker/build-push-action@v5
if: gitea.ref_name == 'master' || gitea.ref_name == ''
@ -33,24 +39,44 @@ jobs:
provenance: false
pull: true
push: true
tags: code.nephatrine.net/nephnet/nxb-cross-dos32:latest-amd64
cache-from: type=registry,ref=code.nephatrine.net/nephnet/nxb-cross-dos32-cache:latest-amd64
cache-to: type=registry,image-manifest=true,oci-mediatypes=true,ref=code.nephatrine.net/nephnet/nxb-cross-dos32-cache:latest-amd64,mode=max
file: Dockerfile
tags: code.nephatrine.net/nephnet/nxb-cross-dos32-amd64:latest
cache-from: type=registry,ref=code.nephatrine.net/nephnet/nxb-cross-dos32-amd64:latest-cache
cache-to: type=registry,image-manifest=true,oci-mediatypes=true,ref=code.nephatrine.net/nephnet/nxb-cross-dos32-amd64:latest-cache,mode=max
- name: Build & Push (Branch)
if: gitea.ref_name != 'master' && gitea.ref_name != ''
run: |
export BRANCH=${GITHUB_REF##*/}
export BRANCH=${BRANCH:-unknown}
docker buildx build --pull -t code.nephatrine.net/nephnet/nxb-cross-dos32:${BRANCH}-latest-amd64 --platform linux/amd64 ${{ gitea.workspace }}
docker buildx build --pull -t code.nephatrine.net/nephnet/nxb-cross-dos32:${BRANCH}-latest-amd64 --platform linux/amd64 -f Dockerfile ${{ gitea.workspace }}
- name: Notify Discord
uses: https://github.com/sarisia/actions-status-discord@v1
if: failure() || gitea.event_name != 'schedule'
with:
title: "Container Build (X86_64)"
title: "Container Build (X86_64; DJGPP)"
webhook: ${{ secrets.DISCORD_WEBHOOK_BUILD }}
build_i386:
if: gitea.repository_owner == 'NephNET' && (!contains(gitea.event.head_commit.message, '#noci') || gitea.event_name == 'schedule')
push_latest_amd64:
if: gitea.ref_name == 'master' || gitea.ref_name == ''
needs: [build_latest_amd64]
runs-on: nephnet-amd64
continue-on-error: true
steps:
- name: Docker Login
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Tag & Push
run: |
docker pull code.nephatrine.net/nephnet/nxb-cross-dos32-amd64:latest --platform linux/amd64
docker tag code.nephatrine.net/nephnet/nxb-cross-dos32-amd64:latest nephatrine/amd64:nxb-cross-dos32-latest
docker rmi code.nephatrine.net/nephnet/nxb-cross-dos32-amd64:latest
docker push nephatrine/amd64:nxb-cross-dos32-latest
docker rmi nephatrine/amd64:nxb-cross-dos32-latest
build_latest_i386:
if: gitea.repository_owner == 'NephNET' && (!(startsWith(gitea.event.head_commit.message, 'chore') || startsWith(gitea.event.head_commit.message, 'docs')) || gitea.event_name == 'schedule')
runs-on: nephnet-i386
continue-on-error: true
steps:
- name: Checkout Repository
uses: https://gitea.com/actions/checkout@v4
@ -63,6 +89,11 @@ jobs:
registry: code.nephatrine.net
username: ${{ gitea.actor }}
password: ${{ secrets.PACKAGER_TOKEN }}
- name: Docker Login (Pull Auth)
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build & Push (Master)
uses: https://github.com/docker/build-push-action@v5
if: gitea.ref_name == 'master' || gitea.ref_name == ''
@ -72,58 +103,98 @@ jobs:
provenance: false
pull: true
push: true
tags: code.nephatrine.net/nephnet/nxb-cross-dos32:latest-i386
cache-from: type=registry,ref=code.nephatrine.net/nephnet/nxb-cross-dos32-cache:latest-i386
cache-to: type=registry,image-manifest=true,oci-mediatypes=true,ref=code.nephatrine.net/nephnet/nxb-cross-dos32-cache:latest-i386,mode=max
file: Dockerfile
tags: code.nephatrine.net/nephnet/nxb-cross-dos32-i386:latest
cache-from: type=registry,ref=code.nephatrine.net/nephnet/nxb-cross-dos32-i386:latest-cache
cache-to: type=registry,image-manifest=true,oci-mediatypes=true,ref=code.nephatrine.net/nephnet/nxb-cross-dos32-i386:latest-cache,mode=max
- name: Build & Push (Branch)
if: gitea.ref_name != 'master' && gitea.ref_name != ''
run: |
export BRANCH=${GITHUB_REF##*/}
export BRANCH=${BRANCH:-unknown}
docker buildx build --pull -t code.nephatrine.net/nephnet/nxb-cross-dos32:${BRANCH}-latest-i386 --platform linux/386 ${{ gitea.workspace }}
docker buildx build --pull -t code.nephatrine.net/nephnet/nxb-cross-dos32:${BRANCH}-latest-i386 --platform linux/386 -f Dockerfile ${{ gitea.workspace }}
- name: Notify Discord
uses: https://github.com/sarisia/actions-status-discord@v1
if: failure() || gitea.event_name != 'schedule'
if: failure()
with:
title: "Container Build (I686)"
title: "Container Build (I686; DJGPP)"
webhook: ${{ secrets.DISCORD_WEBHOOK_BUILD }}
build_manifest:
push_latest_i386:
if: gitea.ref_name == 'master' || gitea.ref_name == ''
needs: [build_amd64, build_i386]
needs: [build_latest_i386]
runs-on: nephnet-amd64
continue-on-error: true
steps:
- name: Check Base Image
if: gitea.event_name == 'schedule'
uses: https://github.com/lucacome/docker-image-update-checker@v1
id: checkbase
- name: Docker Login
uses: https://github.com/docker/login-action@v3
with:
base-image: nephatrine/nxbuilder:debian-stable
image: nephatrine/nxbuilder:cross-dos32
platforms: linux/amd64
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Tag & Push
run: |
docker pull code.nephatrine.net/nephnet/nxb-cross-dos32-i386:latest --platform linux/386
docker tag code.nephatrine.net/nephnet/nxb-cross-dos32-i386:latest nephatrine/ia32:nxb-cross-dos32-latest
docker rmi code.nephatrine.net/nephnet/nxb-cross-dos32-i386:latest
docker push nephatrine/ia32:nxb-cross-dos32-latest
docker rmi nephatrine/ia32:nxb-cross-dos32-latest
build_latest:
if: gitea.ref_name == 'master' || gitea.ref_name == ''
needs: [build_latest_amd64, build_latest_i386]
runs-on: nephnet
continue-on-error: true
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: |
docker manifest create code.nephatrine.net/nephnet/nxb-cross-dos32:latest --amend code.nephatrine.net/nephnet/nxb-cross-dos32-amd64:latest --amend code.nephatrine.net/nephnet/nxb-cross-dos32-i386:latest
docker manifest create code.nephatrine.net/nephnet/nxb-cross-dos32:djgpp --amend code.nephatrine.net/nephnet/nxb-cross-dos32-amd64:latest --amend code.nephatrine.net/nephnet/nxb-cross-dos32-i386:latest
docker manifest push --purge code.nephatrine.net/nephnet/nxb-cross-dos32:latest
docker manifest push --purge code.nephatrine.net/nephnet/nxb-cross-dos32:djgpp
- name: Notify Discord
uses: https://github.com/sarisia/actions-status-discord@v1
if: failure()
with:
title: "Container Publish (DJGPP)"
webhook: ${{ secrets.DISCORD_WEBHOOK_PACKAGE }}
push_latest:
needs: [push_latest_amd64, push_latest_i386]
runs-on: nephnet
continue-on-error: true
steps:
- 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 buildx imagetools create -t code.nephatrine.net/nephnet/nxb-cross-dos32:latest -t nephatrine/nxbuilder:cross-dos32 code.nephatrine.net/nephnet/nxb-cross-dos32:latest-amd64 code.nephatrine.net/nephnet/nxb-cross-dos32:latest-i386
run: |
docker manifest create nephatrine/nxb-cross-dos32:latest --amend nephatrine/amd64:nxb-cross-dos32-latest --amend nephatrine/ia32:nxb-cross-dos32-latest
docker manifest create nephatrine/nxb-cross-dos32:djgpp --amend nephatrine/amd64:nxb-cross-dos32-latest --amend nephatrine/ia32:nxb-cross-dos32-latest
docker manifest push --purge nephatrine/nxb-cross-dos32:latest
docker manifest push --purge nephatrine/nxb-cross-dos32:djgpp
- name: Notify Discord
if: gitea.event_name != 'schedule' || steps.checkbase.outputs.needs-updating == 'true'
if: gitea.event_name != 'schedule'
uses: https://github.com/sarisia/actions-status-discord@v1
with:
title: "DockerHub: nxb-cross-dos32"
description: "The container image was pushed to [DockerHub](https://hub.docker.com/repository/docker/nephatrine/nxbuilder/general).\nPull `nephatrine/nxbuilder:cross-dos32` for the newest image."
title: "DockerHub: nxb-cross-dos32 (DJGPP)"
description: "The container image was pushed to [DockerHub](https://hub.docker.com/repository/docker/nephatrine/nxb-cross-dos32/general).\nPull `nephatrine/nxb-cross-dos32:3.19` for the newest image."
nodetail: true
webhook: ${{ secrets.DISCORD_WEBHOOK_PACKAGE }}
- name: Notify Discord
uses: https://github.com/sarisia/actions-status-discord@v1
if: failure()
update_readme:
needs: [push_latest]
runs-on: nephnet
continue-on-error: true
steps:
- name: Checkout Repository
uses: https://gitea.com/actions/checkout@v4
- name: Docker Describe
uses: https://github.com/peter-evans/dockerhub-description@v3
with:
title: "Container Publish"
webhook: ${{ secrets.DISCORD_WEBHOOK_PACKAGE }}
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
repository: nephatrine/nxb-cross-dos32

View File

@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: ISC
FROM code.nephatrine.net/nephnet/nxb-debian:stable
FROM code.nephatrine.net/nephnet/nxb-debian:latest
LABEL maintainer="Daniel Wolf <nephatrine@gmail.com>"
ARG DEBIAN_FRONTEND=noninteractive

View File

@ -1,11 +1,11 @@
<!--
SPDX-FileCopyrightText: 2023 Daniel Wolf <nephatrine@gmail.com>
SPDX-FileCopyrightText: 2023 - 2024 Daniel Wolf <nephatrine@gmail.com>
SPDX-License-Identifier: ISC
-->
[Git](https://code.nephatrine.net/NephNET/builder-cross-dos32/src/branch/master) |
[Docker](https://hub.docker.com/r/nephatrine/nxbuilder/)
[Docker](https://hub.docker.com/r/nephatrine/nxb-cross-dos32/)
# NXBuilder
@ -37,5 +37,5 @@ beyond that. It can also be used as a quick "cleanroom" to test builds in.
You can spin up a quick temporary test container like this:
~~~
docker run --rm -ti nephatrine/nxbuilder:cross-dos32 /bin/bash
docker run --rm -ti nephatrine/nxb-cross-dos32:latest /bin/bash
~~~