Skip to content

Always Up To Date #11265

Always Up To Date

Always Up To Date #11265

Workflow file for this run

name: Always Up To Date
on:
workflow_dispatch:
schedule:
- cron: "*/20 * * * *"
jobs:
prepare:
name: Prepare Actions
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
require: ${{ steps.require.outputs.require }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: base
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
- name: Determine if update is required
id: require
run: |
REQUIRE=$(./gradlew -q checkNeedsUpdate)
echo "$REQUIRE."
echo "require=$REQUIRE" >> $GITHUB_OUTPUT
- name: Pull Branches
if: steps.require.outputs.require == 'false'
id: matrix
run: |
respond=$(curl --silent https://api.github.com/repos/plazmamc/thunderbolt/branches | jq -rc 'del(.[]|.protected) | del(.[]|.commit)')
flavor=$(echo $respond | jq -rc 'map(select(.name | test("feat/.*")) | .flavor = .name | del(.name))')
echo "matrix={\"include\":$(echo "$base $flavor" | jq -sc add)}" >> $GITHUB_OUTPUT
upstream:
name: Update Base Upstream
needs: prepare
runs-on: ubuntu-latest
if: needs.prepare.outputs.require == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: base
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
- name: Configure Git
run: git config --global user.email "[email protected]" && git config --global user.name "Github Action"
- name: Update upstream
run: ./gradlew updateUpstream
- name: Apply patches
run: ./gradlew applyPatches
- name: Check build
run: ./gradlew build
- name: Commit changes
run: git add . && printf "Updated Upstream (Plazma)\n\nUpstream has released updates that appear to apply and compile correctly\n\n$(cat compare.txt)" | git commit -F -
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
flavor:
name: Update Flavors Upstream
needs: prepare
if: needs.prepare.outputs.require == 'false'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ matrix.flavor }}
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 21
- name: Determine if update is required
id: check
run: echo "needs=$(./gradlew -q checkNeedsUpdate)" >> $GITHUB_OUTPUT
- name: Configure Git
if: steps.check.outputs.needs == 'true'
run: git config --global user.email "[email protected]" && git config --global user.name "Github Action"
- name: Update upstream
if: steps.check.outputs.needs == 'true'
run: ./gradlew updateUpstream
- name: Apply patches
if: steps.check.outputs.needs == 'true'
run: ./gradlew applyPatches
- name: Check build
if: steps.check.outputs.needs == 'true'
run: ./gradlew build
- name: Commit changes
if: steps.check.outputs.needs == 'true'
run: git add . && printf "Updated Upstream (Base)\n\nUpstream has released updates that appear to apply and compile correctly\n\n$(cat compare.txt)" | git commit -F -
- name: Push changes
if: steps.check.outputs.needs == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ matrix.flavor }}