Update .gitea/workflows/production.yaml #59
@@ -1,85 +1,35 @@
|
||||
name: Update WebHosting
|
||||
name: Build & Deploy Prod
|
||||
|
||||
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:
|
||||
update:
|
||||
runs-on: berufsbildung-latest
|
||||
|
||||
jobs:
|
||||
build-main:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Create fork
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Login
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.psi.ch
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build and push DEV
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: gitea.psi.ch/${{ github.repository }}:${{github.run_number}}
|
||||
|
||||
- name: Trigger deployment workflow
|
||||
run: |
|
||||
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: Clone fork
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
git clone \
|
||||
https://oauth2:${GITEA_TOKEN}@gitea.psi.ch/${{ github.repository_owner }}/WebHosting_DMZ.git \
|
||||
webhosting
|
||||
|
||||
- name: Change versions
|
||||
env:
|
||||
PSITRAIL_VERSION: ${{ inputs.psitrail_version }}
|
||||
POCKETAPP_VERSION: ${{ inputs.pocketapp_version }}
|
||||
run: |
|
||||
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"
|
||||
}'
|
||||
-H "Authorization: token ${{ secrets.REGISTRY_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"ref":"main"}' \
|
||||
https://gitea.psi.ch/api/v1/repos/bb_if_produktiv/deployment/actions/workflows/deployProduction.yml/dispatches
|
||||
Reference in new issue
Block a user