Refactor workflows: split pull request build, rename deploy, and remove unused steps

Signed-off-by: Chaoscaot <max@maxsp.de>
This commit is contained in:
2026-05-15 12:47:00 +02:00
parent a5856cf240
commit 202da658ee
3 changed files with 48 additions and 37 deletions
+6 -35
View File
@@ -1,6 +1,10 @@
name: Build
name: Deploy
on: [push, pull_request]
on:
push:
branches:
- main
- version/*
jobs:
build:
@@ -40,7 +44,6 @@ jobs:
run: ./gradlew build --no-daemon
- name: Stage deploy artifacts
if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || startsWith(github.ref_name, 'version/')) }}
shell: bash
run: |
set -euo pipefail
@@ -66,7 +69,6 @@ jobs:
cp "WebsiteBackend/build/libs/WebsiteBackend-all.jar" "deploy/website-api.jar"
- name: Upload deploy artifacts
if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || startsWith(github.ref_name, 'version/')) }}
uses: actions/upload-artifact@v3
with:
name: steamwar-jars
@@ -76,7 +78,6 @@ jobs:
name: Deploy
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || startsWith(github.ref_name, 'version/')) }}
steps:
- name: Download deploy artifacts
uses: actions/download-artifact@v3
@@ -129,33 +130,3 @@ jobs:
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "mkdir -p '$DEPLOY_PATH'"
scp -i ~/.ssh/deploy_key -P "$port" deploy/* "${DEPLOY_USER}@${DEPLOY_HOST}:$DEPLOY_PATH/"
merge-backport:
name: Merge backport
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'version/') && startsWith(github.event.pull_request.head.ref, 'backport/pr-') }}
permissions:
contents: write
pull-requests: write
steps:
- name: Merge successful backport PR
shell: bash
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
set -euo pipefail
pr_number="$(jq -r '.number' "$GITHUB_EVENT_PATH")"
target_branch="$(jq -r '.pull_request.base.ref' "$GITHUB_EVENT_PATH")"
payload="$(jq -n \
--arg title "Merge backport #${pr_number} into ${target_branch}" \
'{Do: "merge", MergeTitleField: $title, MergeMessageField: "Automatic CommonCore backport after successful build.", delete_branch_after_merge: true}')"
curl --fail --silent --show-error \
-X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
--data "$payload" \
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/pulls/${pr_number}/merge"