39 lines
1.2 KiB
YAML
39 lines
1.2 KiB
YAML
|
on:
|
||
|
push:
|
||
|
paths:
|
||
|
- website/**
|
||
|
|
||
|
jobs:
|
||
|
deploy:
|
||
|
runs-on: debian
|
||
|
defaults:
|
||
|
run:
|
||
|
working-directory: website
|
||
|
steps:
|
||
|
- uses: actions/checkout@v1
|
||
|
- name: setup env
|
||
|
run: |
|
||
|
. ./.env || true
|
||
|
if [ "${{ gitea.ref_name }}" == prod ] && [ -n "$PROD_URL" ]; then
|
||
|
BASE_URL="$PROD_URL"
|
||
|
else
|
||
|
BASE_URL="${{ gitea.ref_name }}.$(tr / '\n' <<< "${{ gitea.repository }}" | tac | tr '\n' .)k8s.gmoker.com"
|
||
|
fi
|
||
|
REGISTRY="$(sed 's .*:// ' <<< ${{ gitea.server_url }})"
|
||
|
cat <<EOF >> .env
|
||
|
BASE_URL="$(printf '%s' "$BASE_URL" | tr '[:upper:]' '[:lower:]' | tr -c '[:lower:][:digit:]-.' -)"
|
||
|
IMAGEAPP="$REGISTRY/$(printf '%s' "${{ gitea.repository }}:${{ gitea.ref_name }}" | tr '[:upper:]' '[:lower:]' | tr -c '[:lower:][:digit:]-/:_' _)"
|
||
|
EOF
|
||
|
cat .env
|
||
|
|
||
|
- uses: actions/kaniko@v1
|
||
|
with:
|
||
|
password: "${{ secrets.PKGRW }}"
|
||
|
dockerfile: website/Dockerfile
|
||
|
|
||
|
- uses: actions/k8sdeploy@v1
|
||
|
with:
|
||
|
kubeconfig: "${{ secrets.K8S }}"
|
||
|
registry_password: "${{ secrets.PKGRW }}"
|
||
|
workdir: website
|