ci: run only the image job for a registry check
This commit is contained in:
1 parent
145c44f335
commit
c6946b9a2f
1 file changed
+18
-23
@@ -4,35 +4,30 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
image:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: gitea.tap-tap.win/taptap/audiomanager-ci:2
|
||||
steps:
|
||||
- name: Check credentials and push path
|
||||
- uses: actions/checkout@v4
|
||||
- name: Log in to the registry
|
||||
run: |
|
||||
echo "${{ secrets.AUDIOMANAGER_REGISTRY_TOKEN }}" \
|
||||
| docker login "$REGISTRY" \
|
||||
--username "${{ gitea.actor }}" \
|
||||
--password-stdin
|
||||
env:
|
||||
TOKEN: ${{ secrets.AUDIOMANAGER_REGISTRY_TOKEN }}
|
||||
REGISTRY: gitea.tap-tap.win
|
||||
- name: Build and push
|
||||
env:
|
||||
REGISTRY: gitea.tap-tap.win
|
||||
IMAGE_NAME: taptap/audiomanager
|
||||
run: |
|
||||
set -euo pipefail
|
||||
echo "token_len=${#TOKEN}"
|
||||
printf '%s' "$TOKEN" | sha256sum
|
||||
printf '%s' "$TOKEN" | docker login gitea.tap-tap.win -u "${{ gitea.actor }}" --password-stdin
|
||||
python3 -c '
|
||||
import json,base64,hashlib,os
|
||||
cfg=json.load(open(os.path.expanduser("~/.docker/config.json")))
|
||||
user,pw=base64.b64decode(cfg["auths"]["gitea.tap-tap.win"]["auth"]).decode().split(":",1)
|
||||
print("config_user=%s pw_len=%d pw_sha256=%s" % (user,len(pw),hashlib.sha256(pw.encode()).hexdigest()))
|
||||
'
|
||||
BEARER=$(curl -fsS -u "${{ gitea.actor }}:$TOKEN" \
|
||||
'https://gitea.tap-tap.win/v2/token?service=container_registry&scope=repository:taptap/audiomanager-ci-test:pull,push' \
|
||||
| python3 -c 'import json,sys;d=json.load(sys.stdin);print(d.get("token") or d.get("access_token"))')
|
||||
echo "bearer_len=${#BEARER}"
|
||||
printf '%s' "$BEARER" | cut -d. -f2 | tr '_-' '/+' | base64 -d 2>/dev/null || true
|
||||
echo
|
||||
mkdir -p /tmp/ctx /kaniko/.docker
|
||||
printf 'FROM alpine:3.20\n' > /tmp/ctx/Dockerfile
|
||||
mkdir -p /kaniko/.docker
|
||||
cp "$HOME/.docker/config.json" /kaniko/.docker/config.json
|
||||
kaniko-executor \
|
||||
--context=dir:///tmp/ctx \
|
||||
--dockerfile=/tmp/ctx/Dockerfile \
|
||||
--destination=gitea.tap-tap.win/taptap/audiomanager-ci-test:ci-check
|
||||
--context="dir://$PWD" \
|
||||
--dockerfile="$PWD/Dockerfile" \
|
||||
--snapshot-mode=redo \
|
||||
--destination="$REGISTRY/$IMAGE_NAME:ci-image-check"
|
||||
Reference in new issue
Block a user