39520343da
- Add Gitea Actions workflow (.gitea/workflows/ci.yaml) - Update K8s deployment image registry to oci.unbound.se
49 lines
1.5 KiB
YAML
49 lines
1.5 KiB
YAML
name: geo-service
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
branches: [master]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
BUILDTOOLS_CONTENT: ${{ secrets.BUILDTOOLS_CONTENT }}
|
|
GITEA_REPOSITORY: ${{ gitea.repository }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: buildtool/setup-buildtools-action@v1
|
|
- name: Compare tokens
|
|
run: |
|
|
TOKEN_FROM_CONTENT=$(echo "$BUILDTOOLS_CONTENT" | grep 'token:' | head -1 | awk '{print $2}')
|
|
REGISTRY_TOKEN="${{ secrets.REGISTRY_TOKEN }}"
|
|
echo "Token from BUILDTOOLS_CONTENT length: ${#TOKEN_FROM_CONTENT}"
|
|
echo "REGISTRY_TOKEN length: ${#REGISTRY_TOKEN}"
|
|
if [ "$TOKEN_FROM_CONTENT" = "$REGISTRY_TOKEN" ]; then
|
|
echo "Tokens match!"
|
|
else
|
|
echo "Tokens DO NOT match!"
|
|
echo "BUILDTOOLS token hash: $(echo -n "$TOKEN_FROM_CONTENT" | sha256sum | cut -c1-16)"
|
|
echo "REGISTRY_TOKEN hash: $(echo -n "$REGISTRY_TOKEN" | sha256sum | cut -c1-16)"
|
|
fi
|
|
- name: Build and push
|
|
run: |
|
|
unset GITHUB_REPOSITORY_OWNER GITEA_TOKEN
|
|
build && push
|
|
|
|
deploy-prod:
|
|
needs: build
|
|
if: gitea.ref == 'refs/heads/master'
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
BUILDTOOLS_CONTENT: ${{ secrets.BUILDTOOLS_CONTENT }}
|
|
GITEA_REPOSITORY: ${{ gitea.repository }}
|
|
environment: prod
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: buildtool/setup-buildtools-action@v1
|
|
- name: Deploy
|
|
run: deploy prod
|