yw5ncom/.gitea/workflows/deploy.yaml

32 lines
918 B
YAML
Raw Permalink Normal View History

2024-08-17 15:58:46 +00:00
on: push
jobs:
deploy:
runs-on: debian
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
2024-08-17 16:25:58 +00:00
REGISTRY="$(sed 's .*:// ' <<< ${{ gitea.server_url }})"
2024-08-17 15:58:46 +00:00
cat <<EOF >> .env
BASE_URL="$BASE_URL"
2024-08-17 16:25:58 +00:00
REGISTRY="$REGISTRY"
2024-08-17 16:04:26 +00:00
IMAGEAPP="$REGISTRY/${{ gitea.repository }}:${{ gitea.ref_name }}"
2024-08-17 15:58:46 +00:00
EOF
cat .env
2024-08-17 16:04:26 +00:00
- uses: actions/kaniko@v1
with:
password: "${{ secrets.PKGRW }}"
2024-08-17 15:58:46 +00:00
- uses: actions/k8sdeploy@v1
with:
kubeconfig: "${{ secrets.K8S }}"
2024-08-17 16:04:26 +00:00
registry_password: "${{ secrets.PKGRW }}"