SHA256
Update deploy.yml
This commit is contained in:
1 parent
41d268cc97
commit
80aec43271
1 file changed
+11
-34
+11
-34
@@ -15,20 +15,9 @@ jobs:
|
|||||||
runner: [linux-amd64, linux-arm64]
|
runner: [linux-amd64, linux-arm64]
|
||||||
runs-on: ${{ matrix.runner }}
|
runs-on: ${{ matrix.runner }}
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
container:
|
|
||||||
image: docker:latest
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
run: |
|
uses: actions/checkout@v4
|
||||||
apk add --no-cache git
|
|
||||||
git config --global init.defaultObjectFormat sha256
|
|
||||||
git clone https://${{ github.token }}@git.chillcog.com/${{ github.repository }}.git .
|
|
||||||
git checkout ${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Log in to DHI Registry
|
- name: Log in to DHI Registry
|
||||||
run: |
|
run: |
|
||||||
@@ -36,46 +25,34 @@ jobs:
|
|||||||
|
|
||||||
- name: Log in to Gitea Container Registry
|
- name: Log in to Gitea Container Registry
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.GITHUB_TOKEN }}" | docker login git.chillcog.com -u "${{ github.repository_owner }}" --password-stdin
|
echo "${{ secrets.GITEA_REGISTRY_TOKEN }}" | docker login git.chillcog.com -u "${{ github.repository_owner }}" --password-stdin
|
||||||
|
|
||||||
- name: Detect and Build Images
|
- name: Detect and Build Images
|
||||||
env:
|
env:
|
||||||
REPO_OWNER: ${{ github.repository_owner }}
|
REPO_OWNER: ${{ github.repository_owner }}
|
||||||
EVENT_NAME: ${{ github.event_name }}
|
EVENT_NAME: ${{ github.event_name }}
|
||||||
run: |
|
run: |
|
||||||
apk add --no-cache bash findutils
|
|
||||||
|
|
||||||
FILES_TO_BUILD=""
|
|
||||||
REGISTRY_HOST="git.chillcog.com"
|
REGISTRY_HOST="git.chillcog.com"
|
||||||
|
|
||||||
IF_OWNER="${REPO_OWNER:-chillcog}"
|
IF_OWNER="${REPO_OWNER:-chillcog}"
|
||||||
OWNER_LOWER=$(echo "$IF_OWNER" | tr '[:upper:]' '[:lower:]')
|
OWNER_LOWER=$(echo "$IF_OWNER" | tr '[:upper:]' '[:lower:]')
|
||||||
|
|
||||||
if [ "$EVENT_NAME" = "schedule" ] || [ "$EVENT_NAME" = "workflow_dispatch" ]; then
|
FILES_TO_BUILD=$(find . -maxdepth 1 \( -name "*.yml" -o -name "*.yaml" \))
|
||||||
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=$(find . -maxdepth 1 -name "*.yml" -o -name "*.yaml")
|
|
||||||
fi
|
|
||||||
|
|
||||||
for file in $FILES_TO_BUILD; do
|
for file in $FILES_TO_BUILD; do
|
||||||
file=$(echo "$file" | sed 's|^\./||')
|
file=$(echo "$file" | sed 's|^\./||')
|
||||||
if [ ! -f "$file" ]; then continue; fi
|
|
||||||
if [[ "$file" == .gitea/* ]]; then continue; fi
|
|
||||||
filename=$(basename -- "$file")
|
|
||||||
|
|
||||||
|
[ -f "$file" ] || continue
|
||||||
|
|
||||||
|
filename=$(basename -- "$file")
|
||||||
image_base="${filename%.*}"
|
image_base="${filename%.*}"
|
||||||
image_name=$(echo "$image_base" | tr '[:upper:]' '[:lower:]')
|
image_name=$(echo "$image_base" | tr '[:upper:]' '[:lower:]')
|
||||||
|
|
||||||
|
TARGET_TAG="${REGISTRY_HOST}/${OWNER_LOWER}/${image_name}:latest"
|
||||||
|
|
||||||
echo "---------------------------------------------------"
|
echo "---------------------------------------------------"
|
||||||
echo "Processing: $file -> Target: ${REGISTRY_HOST}/${OWNER_LOWER}/${image_name}:latest"
|
echo "Processing: $file -> Target: $TARGET_TAG"
|
||||||
echo "---------------------------------------------------"
|
echo "---------------------------------------------------"
|
||||||
|
|
||||||
docker build \
|
docker build -f "$file" -t "$TARGET_TAG" .
|
||||||
-f "$file" \
|
docker push "$TARGET_TAG"
|
||||||
-t "${REGISTRY_HOST}/${OWNER_LOWER}/${image_name}:latest" \
|
|
||||||
.
|
|
||||||
|
|
||||||
docker push "${REGISTRY_HOST}/${OWNER_LOWER}/${image_name}:latest"
|
|
||||||
done
|
done
|
||||||
Reference in new issue
Block a user