|
| 1 | +# Syncs upstream macroquest/macroquest into master, then tags vv-emu-rof2. |
| 2 | +# Uses a persistent clone so git rerere accumulates between runs. |
| 3 | +name: OV Sync upstream (MacroQuest rel-emu-rof2) |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + repository_dispatch: |
| 8 | + types: [sync-upstream-emu-rof2] |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: upstream-sync |
| 12 | + cancel-in-progress: false |
| 13 | + |
| 14 | +jobs: |
| 15 | + sync: |
| 16 | + if: github.repository == 'redguides/openvanilla' |
| 17 | + runs-on: [fast, self-hosted, Windows, X64] |
| 18 | + env: |
| 19 | + REPO_DIR: C:\actions-runner\repos\openvanilla |
| 20 | + RG_SYNC_PAT: ${{ secrets.RG_SYNC_PAT }} |
| 21 | + steps: |
| 22 | + - name: Merge macroquest tag rel-emu-rof2 |
| 23 | + shell: pwsh |
| 24 | + env: |
| 25 | + UPSTREAM_TAG: rel-emu-rof2 |
| 26 | + run: | |
| 27 | + $auth = "https://x-access-token:$env:RG_SYNC_PAT@github.com/redguides/openvanilla.git" |
| 28 | +
|
| 29 | + if (-not (Test-Path $env:REPO_DIR)) { |
| 30 | + git clone $auth $env:REPO_DIR |
| 31 | + if ($LASTEXITCODE -ne 0) { throw "Initial clone failed." } |
| 32 | + } |
| 33 | + Set-Location $env:REPO_DIR |
| 34 | +
|
| 35 | + git config user.name "github-actions[bot]" |
| 36 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 37 | +
|
| 38 | + git merge --abort 2>$null |
| 39 | + git reset --hard HEAD |
| 40 | + git clean -ffdx |
| 41 | + git checkout master |
| 42 | + git pull origin master |
| 43 | +
|
| 44 | + git remote add upstream https://github.com/macroquest/macroquest.git 2>$null |
| 45 | + git fetch upstream --tags --force |
| 46 | + git merge $env:UPSTREAM_TAG --no-edit |
| 47 | + if ($LASTEXITCODE -ne 0) { throw "Merge tag $env:UPSTREAM_TAG failed. Resolve in $env:REPO_DIR." } |
| 48 | + git push $auth master |
| 49 | + if ($LASTEXITCODE -ne 0) { throw "Push master failed." } |
| 50 | +
|
| 51 | + - name: Trigger eqlib sync |
| 52 | + shell: pwsh |
| 53 | + env: |
| 54 | + GH_TOKEN: ${{ secrets.RG_SYNC_PAT }} |
| 55 | + run: gh api repos/redguides/eqlib/dispatches -f event_type=sync-upstream |
| 56 | + |
| 57 | + - name: Force-update vv-emu-rof2 tag |
| 58 | + shell: pwsh |
| 59 | + run: | |
| 60 | + Set-Location $env:REPO_DIR |
| 61 | + $auth = "https://x-access-token:$env:RG_SYNC_PAT@github.com/redguides/openvanilla.git" |
| 62 | + git tag -f vv-emu-rof2 |
| 63 | + git push $auth refs/tags/vv-emu-rof2 --force |
0 commit comments