Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate updating rgbds to new version? #65

Open
SelvinPL opened this issue Feb 3, 2025 · 5 comments
Open

Automate updating rgbds to new version? #65

SelvinPL opened this issue Feb 3, 2025 · 5 comments

Comments

@SelvinPL
Copy link
Contributor

SelvinPL commented Feb 3, 2025

The idea is simple. Here is working solution:

This acts as rgbds and this acts as rgbds-live

Every time you publish new Release in "rgbds"(projectx) it will automatically run autoupdate action in "rgbds-live"(projectx_using) with version parameter

This action would:

  • checkout master of rgbds-live(projectx_using)
  • create feature/autoupdate_version branch
  • update rgbds(projectx) submodule to version tag
  • commit change
  • create PR
@SelvinPL

This comment has been minimized.

@SelvinPL
Copy link
Contributor Author

SelvinPL commented Feb 3, 2025

2nd example: this PR is created by this action
SelvinPL#1

Ready to use action

name: Autoupdate
on:
  workflow_dispatch:
    inputs:
      version:
        required: true
jobs:
  build:
    name: Autoupdate RGBDS
    runs-on: ubuntu-latest
    env:
        VERSION : ${{ github.event.inputs.version }}
    steps:
      - name: Checkout repository and submodules
        uses: actions/checkout@v2
        with:
          submodules: recursive
          fetch-depth: '0'
      - name: Create branch
        run: |
          git checkout -b feature/autoupdate_${{env.VERSION}}
      - name: Checkout new RGBDS version (and recreate patch)
        run: |
          cd rgbds
          git checkout ${{env.VERSION}}
          patch -p1 --no-backup-if-mismatch < ../patches/rgbds.patch
          git diff --patch > ../patches/rgbds.patch
          git clean -fd && git reset --hard
          cd ..
      - name: Commit autoupdate
        run: |
          git config --global user.name 'github-actions'
          git config --global user.email '[email protected]'
          git commit -am "Autoupdate RGBDS ${{env.VERSION}}"
          git push origin feature/autoupdate_${{env.VERSION}}
      - name: Create pull request
        run: |
          gh pr create -H feature/autoupdate_${{env.VERSION}} -B master --title 'Autoupdate RGBDS ${{env.VERSION}}' --body 'Autoupdate RGBDS ${{env.VERSION}}'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
patch -p1 --no-backup-if-mismatch < ../patches/rgbds.patch
git diff --patch > ../patches/rgbds.patch
git clean -fd && git reset --hard

^^^^^
will try to reindex the patch file (it basically apply the patch and regenerate it and then remove changes)

(for the future readers: this pull request prolly not exists as I like to"re-fork" clean repo when I'm adding something - it was only here for showcase a running solution)

@avivace
Copy link
Member

avivace commented Feb 4, 2025

This is a cool idea, although are we sure that the patch will remain working when upstream source code changes?

@SelvinPL
Copy link
Contributor Author

SelvinPL commented Feb 4, 2025

This is a cool idea, although are we sure that the patch will remain working when upstream source code changes?

This is only PR ... so if there is breaking change which mess up with patching it should just fail test build

Edit: If so, someone need to do this manually
Edit: PR WILL NOT BE automatically accepted! I've accepted it in my fork manually

@SelvinPL
Copy link
Contributor Author

SelvinPL commented Feb 4, 2025

@avivace
We can also skip integrtion with rgbds and just run this manually

Image

You need to put rgbds version to which you wana update and run action

It will produce PR like this (I leave it open)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants