9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-25 09:49:28 +00:00
Files
DivineMC/.github/workflows/automatic-update.yml
2023-12-15 21:12:49 +08:00

53 lines
1.5 KiB
YAML

name: Automatically update Purpur commit hash
on:
workflow_dispatch: {}
schedule:
- cron: "0 0 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout DivineMC Repository
uses: actions/checkout@v3
with:
path: 'DivineMC'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Purpur Repository
uses: actions/checkout@v3
with:
path: 'Purpur'
repository: "PurpurMC/Purpur"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get Purpur Latest Commit Hash
id: purpurRef
run: |
ls
cd Purpur
echo "::set-output name=purpurRef::$(git rev-parse HEAD)"
cd ..
- name: Update purpurRef in DivineMC
run: |
cd DivineMC
echo "Before sed:"
cat gradle.properties
sed -i "s/\(purpurRef\s*=\s*\).*/\1$PAPER_REF/" gradle.properties
echo "After sed:"
cat gradle.properties
env:
PAPER_REF: ${{ steps.purpurRef.outputs.purpurRef }}
- name: Write to repository
run: |
cd DivineMC
echo "Current directory: $(pwd)"
git status
git add gradle.properties
git status
git config user.name "HaHaWTH"
git config user.email 47356322+HaHaWTH@users.noreply.github.com
git commit -m "Updated Upstream (Purpur)"
git push