SHA256
Changed deploy to be for the gitea packages deploy
This commit is contained in:
1 parent
5e27acc1e3
commit
1ae0787b0b
2 files changed
+90
-7
No files matched your search
@@ -41,16 +41,18 @@ jobs:
|
|||||||
username: ${{ secrets.DHI_USERNAME }}
|
username: ${{ secrets.DHI_USERNAME }}
|
||||||
password: ${{ secrets.DHI_PASSWORD }}
|
password: ${{ secrets.DHI_PASSWORD }}
|
||||||
|
|
||||||
- name: Log in to Private Registry
|
- name: Log in to Gitea Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: registry.chillcog.com
|
registry: gitea.chillcog.com
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
username: ${{ gitea.repository_owner }}
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Detect and Build Images
|
- name: Detect and Build Images
|
||||||
run: |
|
run: |
|
||||||
FILES_TO_BUILD=""
|
FILES_TO_BUILD=""
|
||||||
|
REGISTRY_HOST="gitea.chillcog.com" #
|
||||||
|
OWNER_LOWER=$(echo "${{ gitea.repository_owner }}" | tr '[:upper:]' '[:lower:]')
|
||||||
|
|
||||||
if [ "${{ github.event_name }}" = "schedule" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
if [ "${{ github.event_name }}" = "schedule" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
echo "Scheduled or manual run triggered. Processing all YAML files..."
|
echo "Scheduled or manual run triggered. Processing all YAML files..."
|
||||||
@@ -65,10 +67,10 @@ jobs:
|
|||||||
if [ ! -f "$file" ]; then continue; fi
|
if [ ! -f "$file" ]; then continue; fi
|
||||||
if [[ "$file" == .gitea/* ]]; then continue; fi
|
if [[ "$file" == .gitea/* ]]; then continue; fi
|
||||||
filename=$(basename -- "$file")
|
filename=$(basename -- "$file")
|
||||||
image_name="${filename%.*}"
|
image_name=$(echo "${filename%.*}" | tr '[:upper:]' '[:lower:]')
|
||||||
|
|
||||||
echo "---------------------------------------------------"
|
echo "---------------------------------------------------"
|
||||||
echo "Processing: $file -> Target: registry.chillcog.com/${image_name}:latest"
|
echo "Processing: $file -> Target: ${REGISTRY_HOST}/${OWNER_LOWER}/${image_name}:latest"
|
||||||
echo "---------------------------------------------------"
|
echo "---------------------------------------------------"
|
||||||
|
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
@@ -76,6 +78,6 @@ jobs:
|
|||||||
--push \
|
--push \
|
||||||
--no-cache \
|
--no-cache \
|
||||||
-f "$file" \
|
-f "$file" \
|
||||||
-t "registry.chillcog.com/${image_name}:latest" \
|
-t "${REGISTRY_HOST}/${OWNER_LOWER}/${image_name}:latest" \
|
||||||
.
|
.
|
||||||
done
|
done
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
name: Dynamic Build and Deploy Hardened Images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * 5'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
runner: [linux-amd64, linux-arm64]
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
|
steps:
|
||||||
|
- name: Install Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: Prepare Git for SHA256 Repo
|
||||||
|
run: git config --global init.defaultObjectFormat sha256
|
||||||
|
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to DHI Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: dhi.io
|
||||||
|
username: ${{ secrets.DHI_USERNAME }}
|
||||||
|
password: ${{ secrets.DHI_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Log in to Private Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: registry.chillcog.com
|
||||||
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Detect and Build Images
|
||||||
|
run: |
|
||||||
|
FILES_TO_BUILD=""
|
||||||
|
|
||||||
|
if [ "${{ github.event_name }}" = "schedule" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
|
echo "Scheduled or manual run triggered. Processing all YAML files..."
|
||||||
|
FILES_TO_BUILD=$(find . -maxdepth 1 -name "*.yml" -o -name "*.yaml")
|
||||||
|
else
|
||||||
|
echo "Push triggered. Detecting changed files..."
|
||||||
|
FILES_TO_BUILD=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} 2>/dev/null | grep -E '\.(yml|yaml)$' || true)
|
||||||
|
fi
|
||||||
|
|
||||||
|
for file in $FILES_TO_BUILD; do
|
||||||
|
file=$(echo "$file" | sed 's|^\./||')
|
||||||
|
if [ ! -f "$file" ]; then continue; fi
|
||||||
|
if [[ "$file" == .gitea/* ]]; then continue; fi
|
||||||
|
filename=$(basename -- "$file")
|
||||||
|
image_name="${filename%.*}"
|
||||||
|
|
||||||
|
echo "---------------------------------------------------"
|
||||||
|
echo "Processing: $file -> Target: registry.chillcog.com/${image_name}:latest"
|
||||||
|
echo "---------------------------------------------------"
|
||||||
|
|
||||||
|
docker buildx build \
|
||||||
|
--platform linux/amd64,linux/arm64 \
|
||||||
|
--push \
|
||||||
|
--no-cache \
|
||||||
|
-f "$file" \
|
||||||
|
-t "registry.chillcog.com/${image_name}:latest" \
|
||||||
|
.
|
||||||
|
done
|
||||||
Reference in new issue
Block a user