Skip to content

Commit

Permalink
Copy over the buildscript updater (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
ALongStringOfNumbers committed Jan 12, 2024
1 parent dfeabe8 commit 413fbdb
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/update_buildscript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Checks daily to see if the buildscript is in need of an update
name: Buildscript Updating

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *" # "min hr day month year", so run once per day

jobs:
buildscript-update:
runs-on: ubuntu-latest
# Avoid running this workflow on forks
if: github.repository == 'GregTechCEu/gregicality-multiblocks'
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Run script updater
uses: gradle/gradle-build-action@v2
with:
arguments: 'updateBuildScript'
generate-job-summary: false
gradle-home-cache-includes: |
caches
jdks
notifications
wrapper
- name: Get new script version
id: version-check
run: |
new_version=$(head -1 build.gradle | sed -r 's|//version: (.*)|\1|g')
echo "NEW_VERSION=$new_version" >> "$GITHUB_OUTPUT"
- name: Create Pull Request
id: create-pull-request
uses: peter-evans/create-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.BUILDSCRIPT_UPDATER_TOKEN }}
with:
token: ${{ secrets.BUILDSCRIPT_UPDATER_TOKEN }}
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit-message: 'update build script version to ${{ steps.version-check.outputs.NEW_VERSION }}'
branch: gha-update-buildscript
title: Update build script version to ${{ steps.version-check.outputs.NEW_VERSION }}
body: This pull request is created by the buildscript-update workflow
labels: ignore changelog

- name: Enable pull request auto-merge
id: pull-request-auto-merge
if: steps.create-pull-request.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v3
with:
token: ${{ secrets.BUILDSCRIPT_UPDATER_TOKEN }}
pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }}
merge-method: squash

0 comments on commit 413fbdb

Please sign in to comment.