Update Forgejo admin publish workflow
This commit is contained in:
parent
becc90b48c
commit
d13fc3218a
1 changed files with 12 additions and 9 deletions
|
|
@ -37,22 +37,24 @@ jobs:
|
|||
|
||||
- name: Login to registry
|
||||
env:
|
||||
REGISTRY_HOSTPORT: ${{ secrets.REGISTRY_HOSTPORT }}
|
||||
REGISTRY_HOST: ${{ secrets.REGISTRY_HOST || 'ci.nxtgauge.com' }}
|
||||
REGISTRY_NAMESPACE: ${{ secrets.REGISTRY_NAMESPACE || 'ashwin' }}
|
||||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "$REGISTRY_HOSTPORT"
|
||||
printf '%s' "$REGISTRY_PASSWORD" | docker login "$REGISTRY_HOSTPORT" -u "$REGISTRY_USERNAME" --password-stdin
|
||||
test -n "$REGISTRY_HOST"
|
||||
printf '%s' "$REGISTRY_PASSWORD" | docker login "$REGISTRY_HOST" -u "$REGISTRY_USERNAME" --password-stdin
|
||||
|
||||
- name: Build and push image
|
||||
env:
|
||||
REGISTRY_HOSTPORT: ${{ secrets.REGISTRY_HOSTPORT }}
|
||||
REGISTRY_HOST: ${{ secrets.REGISTRY_HOST || 'ci.nxtgauge.com' }}
|
||||
REGISTRY_NAMESPACE: ${{ secrets.REGISTRY_NAMESPACE || 'ashwin' }}
|
||||
SHA: ${{ github.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
metadata_file="/tmp/admin-solid-metadata.json"
|
||||
image_ref="$REGISTRY_HOSTPORT/nxtgauge-admin-solid:$SHA"
|
||||
image_ref="$REGISTRY_HOST/$REGISTRY_NAMESPACE/nxtgauge-admin-solid:$SHA"
|
||||
|
||||
docker buildx build --push \
|
||||
--metadata-file "$metadata_file" \
|
||||
|
|
@ -62,20 +64,21 @@ jobs:
|
|||
|
||||
digest="$(grep -o '"containerimage.digest":"sha256:[^"]*"' "$metadata_file" | cut -d'"' -f4)"
|
||||
test -n "$digest"
|
||||
printf '%s@%s\n' "$REGISTRY_HOSTPORT/nxtgauge-admin-solid" "$digest" > /tmp/admin-solid-image-ref.txt
|
||||
printf '%s@%s\n' "$REGISTRY_HOST/$REGISTRY_NAMESPACE/nxtgauge-admin-solid" "$digest" > /tmp/admin-solid-image-ref.txt
|
||||
|
||||
- name: Prune old SHA tags
|
||||
if: success()
|
||||
continue-on-error: true
|
||||
env:
|
||||
REGISTRY_HOST: ${{ secrets.REGISTRY_HOSTPORT }}
|
||||
REGISTRY_HOST: ${{ secrets.REGISTRY_HOST || 'ci.nxtgauge.com' }}
|
||||
REGISTRY_NAMESPACE: ${{ secrets.REGISTRY_NAMESPACE || 'ashwin' }}
|
||||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python3 .forgejo/scripts/registry_prune.py \
|
||||
--registry "$REGISTRY_HOST" \
|
||||
--repo "nxtgauge-admin-solid" \
|
||||
--repo "$REGISTRY_NAMESPACE/nxtgauge-admin-solid" \
|
||||
--username "$REGISTRY_USERNAME" \
|
||||
--password "$REGISTRY_PASSWORD" \
|
||||
--keep 2
|
||||
|
|
@ -93,7 +96,7 @@ jobs:
|
|||
mkdir -p ~/.ssh
|
||||
printf '%s\n' "$GITEOPS_SSH_KEY" > ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
ssh-keyscan github.com >> ~/.ssh/known_hosts 2>/dev/null
|
||||
for host in github.com ci.nxtgauge.com; do ssh-keyscan -H "$host" >> ~/.ssh/known_hosts 2>/dev/null || true; done
|
||||
|
||||
GITEOPS_DIR=$(mktemp -d)
|
||||
git clone "$GITEOPS_REPO" "$GITEOPS_DIR"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue