Some checks failed
💙 Generating a PUBLIC Live ISO. / 💙 Generating a PUBLIC Live ISO. (push) Has been cancelled
🔐 Generating a Private Live ISO TRIXIE. / 🔐 Generating a Private Live ISO TRIXIE. (push) Has been cancelled
🛡️ Retrieve DNSSEC status of coresecret.dev. / 🛡️ Retrieve DNSSEC status of coresecret.dev. (push) Successful in 1m6s
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m47s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
212 lines
7.3 KiB
YAML
212 lines
7.3 KiB
YAML
# SPDX-Version: 3.0
|
|
# SPDX-CreationInfo: 2025-05-05; WEIDNER, Marc S.; <msw@coresecret.dev>
|
|
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.live.builder.git
|
|
# SPDX-FileContributor: WEIDNER, Marc S.; Centurion Intelligence Consulting Agency
|
|
# SPDX-FileCopyrightText: 2024-2025; WEIDNER, Marc S.; <msw@coresecret.dev>
|
|
# SPDX-FileType: SOURCE
|
|
# SPDX-License-Identifier: LicenseRef-CNCL-1.1 OR LicenseRef-CCLA-1.1
|
|
# SPDX-LicenseComment: This file is part of the CISS.debian.installer.secure framework.
|
|
# SPDX-PackageName: CISS.debian.live.builder
|
|
# SPDX-Security-Contact: security@coresecret.eu
|
|
|
|
# Version Master V8.13.512.2025.11.27
|
|
|
|
name: 🔁 Render Graphviz Diagrams.
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- "**/*.gv"
|
|
- "**/*.dot"
|
|
|
|
jobs:
|
|
build-graphiz-diagrams:
|
|
name: 🔁 Render Graphviz Diagrams.
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
working-directory: ${{ github.workspace }}
|
|
|
|
steps:
|
|
- name: 🕑 Waiting random time to desynchronize parallel workflows.
|
|
run: |
|
|
set -euo pipefail
|
|
var_wait=$(( RANDOM % 33 ))
|
|
printf "🕑 Waiting %s seconds to desynchronize parallel workflows...\n" "${var_wait}"
|
|
sleep "${var_wait}"
|
|
|
|
- name: ⚙️ Preparing SSH Setup, SSH Deploy Key, Known Hosts, .config.
|
|
run: |
|
|
set +x
|
|
set -euo pipefail
|
|
rm -rf ~/.ssh && mkdir -m700 ~/.ssh
|
|
|
|
### Private Key
|
|
echo "${{ secrets.SSH_MSW_DEPLOY_CORESECRET_DEV }}" >| ~/.ssh/id_ed25519
|
|
chmod 0600 ~/.ssh/id_ed25519
|
|
|
|
### Scan git.coresecret.dev to fill ~/.ssh/known_hosts
|
|
ssh-keyscan -p 42842 git.coresecret.dev >| ~/.ssh/known_hosts
|
|
chmod 0600 ~/.ssh/known_hosts
|
|
|
|
### Generate SSH Config for git.coresecret.dev Custom-Port
|
|
cat <<EOF >| ~/.ssh/config
|
|
Host git.coresecret.dev
|
|
BatchMode yes
|
|
ConnectTimeout 5
|
|
ControlMaster auto
|
|
ControlPath ~/.ssh/cm-%r@%h:%p
|
|
ControlPersist 5m
|
|
HostName git.coresecret.dev
|
|
IdentityFile ~/.ssh/id_ed25519
|
|
Port 42842
|
|
ServerAliveCountMax 3
|
|
ServerAliveInterval 10
|
|
StrictHostKeyChecking yes
|
|
User git
|
|
UserKnownHostsFile ~/.ssh/known_hosts
|
|
EOF
|
|
chmod 0600 ~/.ssh/config
|
|
|
|
### https://github.com/actions/checkout/issues/1843
|
|
- name: 🔧 Using manual clone via SSH to circumvent Gitea SHA-256 object issues.
|
|
env:
|
|
### GITHUB_REF_NAME contains the branch name from the push event.
|
|
GITHUB_REF_NAME: ${{ github.ref_name }}
|
|
run: |
|
|
set -euo pipefail
|
|
git clone --branch "${GITHUB_REF_NAME}" ssh://git@git.coresecret.dev:42842/msw/CISS.debian.live.builder.git .
|
|
|
|
- name: ⚙️ Importing the 'CI PGP DEPLOY ONLY' key.
|
|
run: |
|
|
set -euo pipefail
|
|
### GPG-Home relative to the Runner Workspace to avoid changing global files.
|
|
export GNUPGHOME="$(PWD)/.gnupg"
|
|
mkdir -m 0700 "${GNUPGHOME}"
|
|
echo "${{ secrets.PGP_MSW_DEPLOY_CORESECRET_DEV }}" >| ci-bot.sec.asc
|
|
gpg --batch --import ci-bot.sec.asc
|
|
### Trust the key automatically
|
|
KEY_ID=$(gpg --list-keys --with-colons | awk -F: '/^pub:/ {print $5}')
|
|
echo "trust-model always" >| "${GNUPGHOME}/gpg.conf"
|
|
|
|
- name: ⚙️ Configuring Git for signed CI/DEPLOY commits.
|
|
run: |
|
|
set -euo pipefail
|
|
export GNUPGHOME="$(PWD)/.gnupg"
|
|
git config user.name "Marc S. Weidner BOT"
|
|
git config user.email "msw+bot@coresecret.dev"
|
|
git config commit.gpgsign true
|
|
git config gpg.program gpg
|
|
git config gpg.format openpgp
|
|
|
|
- name: ⚙️ Convert APT sources to HTTPS.
|
|
run: |
|
|
set -euo pipefail
|
|
sed -i 's|http://\(archive\.ubuntu\.com\|security\.ubuntu\.com\)|https://\1|g' /etc/apt/sources.list
|
|
sed -i 's|http://\(archive\.ubuntu\.com\|security\.ubuntu\.com\)|https://\1|g' /etc/apt/sources.list.d/*.list || true
|
|
|
|
- name: 🔧 Install Graphviz.
|
|
run: |
|
|
set -euo pipefail
|
|
sudo apt-get update
|
|
sudo apt-get install -y graphviz
|
|
|
|
- name: 🔧 Render all .dot / .gv to PNG.
|
|
run: |
|
|
set -euo pipefail
|
|
find . -type f \( -name "*.dot" -o -name "*.gv" \) | while read file; do
|
|
out="${file%.*}.png"
|
|
dot -Tpng "${file}" -o "${out}"
|
|
done
|
|
|
|
- name: 🚧 Stash local changes (including untracked).
|
|
env:
|
|
GIT_SSH_COMMAND: "ssh -p 42842"
|
|
run: |
|
|
set -euo pipefail
|
|
### Temporarily store any local modifications or untracked files.
|
|
git stash push --include-untracked -m "ci-temp" || echo "✔️ Nothing to stash."
|
|
|
|
- name: 🔄 Sync with remote before commit using merge strategy.
|
|
env:
|
|
GIT_SSH_COMMAND: "ssh -p 42842"
|
|
run: |
|
|
set -euo pipefail
|
|
export GNUPGHOME="$(PWD)/.gnupg"
|
|
|
|
echo "🔄 Fetching origin/master ..."
|
|
git fetch origin master
|
|
|
|
echo "🔁 Merging origin/master into current branch ..."
|
|
git merge --no-edit origin/master || echo "✔️ Already up to date or fast-forward."
|
|
|
|
echo "📋 Post-merge status :"
|
|
git status
|
|
git log --oneline -n 5
|
|
|
|
- name: 🔧 Restore stashed changes.
|
|
env:
|
|
GIT_SSH_COMMAND: "ssh -p 42842"
|
|
run: |
|
|
set -euo pipefail
|
|
### Apply previously stashed changes.
|
|
git stash pop || echo "✔️ Nothing to pop."
|
|
|
|
- name: 📦 Stage generated files.
|
|
env:
|
|
GIT_SSH_COMMAND: "ssh -p 42842"
|
|
run: |
|
|
set -euo pipefail
|
|
git add *.png || echo "✔️ Nothing to add."
|
|
|
|
- name: 🔑 Commit and sign changes with CI metadata.
|
|
env:
|
|
GIT_SSH_COMMAND: "ssh -p 42842"
|
|
run: |
|
|
set -euo pipefail
|
|
export GNUPGHOME="$(PWD)/.gnupg"
|
|
|
|
if git diff --cached --quiet; then
|
|
echo "✔️ No staged changes to commit."
|
|
else
|
|
echo "📝 Committing changes with GPG signature ..."
|
|
|
|
### CI Metadata
|
|
TIMESTAMP_UTC="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
|
HOSTNAME="$(hostname -f || hostname)"
|
|
GIT_SHA="$(git rev-parse --short HEAD)"
|
|
GIT_REF="$(git symbolic-ref --short HEAD || echo detached)"
|
|
WORKFLOW_ID="${GITHUB_WORKFLOW:-render-dot-to-png.yaml}"
|
|
CI_HEADER="X-CI-Metadata: ${GIT_REF}@${GIT_SHA} at ${TIMESTAMP_UTC} on ${HOSTNAME}"
|
|
|
|
COMMIT_MSG="DEPLOY BOT : 🔁 Auto-Generate PNG from *.dot. [skip ci]
|
|
|
|
${CI_HEADER}
|
|
|
|
Generated at : ${TIMESTAMP_UTC}
|
|
Runner Host : ${HOSTNAME}
|
|
Workflow ID : ${WORKFLOW_ID}
|
|
Git Commit : ${GIT_SHA} HEAD -> ${GIT_REF}
|
|
"
|
|
|
|
echo "🔏 Commit message :"
|
|
echo "${COMMIT_MSG}"
|
|
git commit -S -m "${COMMIT_MSG}"
|
|
fi
|
|
|
|
- name: 🔁 Push back to repository.
|
|
env:
|
|
GIT_SSH_COMMAND: "ssh -p 42842"
|
|
run: |
|
|
set -euo pipefail
|
|
echo "📤 Pushing changes to ${GITHUB_REF_NAME} ..."
|
|
git push origin HEAD:${GITHUB_REF_NAME}
|
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=yaml
|