Skip to content

json.loads(f) -> json.load(f) #36

json.loads(f) -> json.load(f)

json.loads(f) -> json.load(f) #36

Workflow file for this run

name: ci
on:
push:
branches:
- "master"
- "test"
jobs:
build:
runs-on: actions-runner
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check if commit already pushed to registry
id: check_registry
run: |
python3 -c "
import sys
import urllib.request
import json
import base64
with urllib.request.urlopen('https://ghcr.io/token?scope=repository:wappuradio/webbi:pull') as f:
token = json.load(f)['token']
req = urllib.request.Request(
'https://ghcr.io/v2/wappuradio/webbi/tags/list',
headers={'Authorization': f'Bearer {token}'}
)
with urllib.request.urlopen(req) as f:
if sys.argv[1] in json.load(f)['tags']:
print('exists=true')
else:
print('exists=false')" \
\
"${{ github.sha }}" \
>> $GITHUB_OUTPUT
outputs:
image: ghcr.io/wappuradio/webbi:${{ github.sha }}
deploy:
runs-on: actions-runner
needs: build
environment:
name: test
url: https://webbi-test.wappuradio.fi
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: tale/kubectl-action@v1
with:
base64-kube-config: ${{ secrets.KUBECONFIG_BASE64 }}
- run: cat deployment.yaml | sed 's;IMAGE;${{ needs.build.outputs.image }};' | sed 's/ENV/test/' | kubectl apply -n webbi-test -f -