Update .gitea/workflows/deployProduction.yml #25

Merged
pombas_n merged 1 commits from pombas_n-patch-1 into main 2026-09-15 16:48:51 +02:00
+73 -20
View File
@@ -1,32 +1,85 @@
name: Deploy Production
name: Update WebHosting
on:
push:
branches: [main]
workflow_dispatch:
inputs:
psitrail_version:
description: "Psitrail version"
required: true
type: string
pocketapp_version:
description: "Pocketapp version"
required: true
type: string
jobs:
deploy:
update:
runs-on: berufsbildung-latest
steps:
- name: Clean workspace
- name: Create fork
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
find "${GITHUB_WORKSPACE:?}" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
curl -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
https://gitea.psi.ch/api/v1/repos/linux/WebHosting_DMZ/forks \
-d '{}'
- name: Login to registry
- name: Clone fork
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.psi.ch \
-u "bb_if_produktiv" \
--password-stdin
git clone \
https://oauth2:${GITEA_TOKEN}@gitea.psi.ch/${{ github.repository_owner }}/WebHosting_DMZ.git \
webhosting
- name: Checkout
uses: actions/checkout@v3
- name: Pull images
run: docker compose pull
- name: Restart services
- name: Change versions
env:
PSITRAIL_VERSION: ${{ inputs.psitrail_version }}
POCKETAPP_VERSION: ${{ inputs.pocketapp_version }}
run: |
docker compose down
docker compose build --no-cache
docker compose up -d --force-recreate
cd webhosting
sed -i \
"s#bb_if_produktiv/psitrail:[^[:space:]]*#bb_if_produktiv/psitrail:${PSITRAIL_VERSION}#g" \
docker-compose.yaml
sed -i \
"s#bb_if_produktiv/pocketapp:[^[:space:]]*#bb_if_produktiv/pocketapp:${POCKETAPP_VERSION}#g" \
docker-compose.yaml
- name: Commit and push
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
cd webhosting
BRANCH="update-versions-${{ github.run_number }}"
git checkout -b "$BRANCH"
git config user.name "Gitea Actions"
git config user.email "actions@localhost"
git add docker-compose.yaml
git commit -m "Update psitrail and pocketapp versions"
git push origin "$BRANCH"
- name: Create Pull Request
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
curl -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
https://gitea.psi.ch/api/v1/repos/linux/WebHosting_DMZ/pulls \
-d '{
"title": "Update psitrail and pocketapp versions",
"body": "Automated version update.",
"head": "${{ github.repository_owner }}:update-versions-${{ github.run_number }}",
"base": "main"
}'