Skip to content

Commit c277234

Browse files
SelvinPLavivace
andauthored
ci: adding workflow to create a PR to update RGBDS's version (#68)
Co-authored-by: Antonio Vivace <[email protected]>
1 parent 5d577b7 commit c277234

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/autoupdate.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Creates a PR for updating RGBDS version automatcally
2+
# Trigger it and put the desired RGBDS version as the "version"
3+
# parameter. Must match one of the available tags: https://github.com/gbdev/rgbds/tags
4+
name: Create PR for new RGBDS version
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
required: true
10+
jobs:
11+
build:
12+
name: Create PR for new RGBDS version
13+
runs-on: ubuntu-latest
14+
env:
15+
VERSION: ${{github.event.inputs.version}}
16+
BRANCH_NAME: autoupdate_rgbds_${{github.event.inputs.version}}
17+
COMMIT_MESSAGE: "dep: update RGBDS to ${{github.event.inputs.version}}"
18+
PR_TITLE: Update RGBDS to ${{github.event.inputs.version}}
19+
PR_BODY: This is an automated PR to bump the RGBDS dependency to version ${{github.event.inputs.version}}. |
20+
The patch was also tentatively updated and applied. Double check that this succeded. |
21+
This Pull Request was created automatically by the 'autoupdate.yml' pipeline.
22+
steps:
23+
- name: Checkout repository and submodules
24+
uses: actions/checkout@v2
25+
with:
26+
submodules: recursive
27+
fetch-depth: '0'
28+
- name: Create autoupdate branch
29+
run: |
30+
git checkout -b feature/${{env.BRANCH_NAME}}
31+
- name: Checkout new RGBDS version (and recreate patch)
32+
run: |
33+
cd rgbds
34+
git checkout ${{env.VERSION}}
35+
patch -p1 --no-backup-if-mismatch < ../patches/rgbds.patch
36+
git diff --patch > ../patches/rgbds.patch
37+
git clean -fd && git reset --hard
38+
cd ..
39+
- name: Commit the changes
40+
run: |
41+
git config --global user.name 'github-actions'
42+
git config --global user.email '[email protected]'
43+
git commit -am "${{env.COMMIT_MESSAGE}}"
44+
git push origin feature/${{env.BRANCH_NAME}}
45+
- name: Create pull request
46+
run: |
47+
gh pr create -H feature/${{env.BRANCH_NAME}} -B master --title '${{env.PR_TITLE}}' --body '${{env.PR_BODY}}'
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)