|
| 1 | +name: Rebase branches against NetBSD |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "17 * * * *" |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + illumos: |
| 9 | + description: 'Rebase release/trunk branch' |
| 10 | + type: boolean |
| 11 | + default: false |
| 12 | + macos: |
| 13 | + description: 'Rebase release/macos branch' |
| 14 | + type: boolean |
| 15 | + default: false |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: write |
| 19 | + |
| 20 | +concurrency: |
| 21 | + group: ${{ github.workflow }} |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +jobs: |
| 25 | + features: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + branch: |
| 32 | + - feature/macos/trunk |
| 33 | + - feature/miscfix/trunk |
| 34 | + - feature/pbulk/trunk |
| 35 | + - feature/pbulkmulti/trunk |
| 36 | + - feature/performance/trunk |
| 37 | + - trunk |
| 38 | + |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v6 |
| 41 | + with: |
| 42 | + fetch-depth: 0 |
| 43 | + |
| 44 | + - name: Configure github-actions bot |
| 45 | + run: | |
| 46 | + git config user.name "github-actions[bot]" |
| 47 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 48 | +
|
| 49 | + - name: Fetch NetBSD/pkgsrc.git |
| 50 | + run: | |
| 51 | + git remote add netbsd https://github.com/NetBSD/pkgsrc.git |
| 52 | + git fetch netbsd |
| 53 | +
|
| 54 | + - name: Rebase ${{ matrix.branch }} |
| 55 | + run: | |
| 56 | + git checkout ${{ matrix.branch }} |
| 57 | + git rebase --committer-date-is-author-date netbsd/trunk |
| 58 | +
|
| 59 | + - name: Push ${{ matrix.branch }} |
| 60 | + run: | |
| 61 | + git push --force origin ${{ matrix.branch }} |
| 62 | +
|
| 63 | + illumos: |
| 64 | + needs: features |
| 65 | + if: ${{ github.event_name != 'workflow_dispatch' || inputs.illumos }} |
| 66 | + runs-on: ubuntu-latest |
| 67 | + |
| 68 | + steps: |
| 69 | + - uses: actions/checkout@v6 |
| 70 | + with: |
| 71 | + fetch-depth: 0 |
| 72 | + submodules: true |
| 73 | + |
| 74 | + - name: Configure github-actions bot |
| 75 | + run: | |
| 76 | + git config user.name "github-actions[bot]" |
| 77 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 78 | +
|
| 79 | + - name: Rebase release/trunk |
| 80 | + run: | |
| 81 | + git checkout release/trunk |
| 82 | + git submodule update --init --recursive |
| 83 | + git submodule foreach ' |
| 84 | + git fetch --all |
| 85 | + main=$(git remote show origin | awk "/HEAD branch/ {print \$NF}") |
| 86 | + git checkout $main |
| 87 | + git pull |
| 88 | + ' |
| 89 | + git reset --hard origin/feature/miscfix/trunk |
| 90 | + for feature in pbulk pbulkmulti performance; do |
| 91 | + git merge --no-edit origin/feature/${feature}/trunk |
| 92 | + done |
| 93 | + git submodule add https://github.com/TritonDataCenter/pkgsrc-extra.git extra |
| 94 | + git submodule add https://github.com/TritonDataCenter/pkgsrc-joyent.git joyent |
| 95 | + git submodule add https://github.com/TritonDataCenter/pkgsrc-wip.git wip |
| 96 | + git add .gitmodules |
| 97 | + git commit -m "Add submodules." |
| 98 | + if [ "$(git rev-parse HEAD^{tree})" = "$(git rev-parse origin/release/trunk^{tree})" ]; then |
| 99 | + echo "No upstream changes, skipping push." |
| 100 | + exit 0 |
| 101 | + fi |
| 102 | + git push --force origin release/trunk |
| 103 | +
|
| 104 | + macos: |
| 105 | + needs: features |
| 106 | + if: ${{ github.event_name != 'workflow_dispatch' || inputs.macos }} |
| 107 | + runs-on: ubuntu-latest |
| 108 | + |
| 109 | + steps: |
| 110 | + - uses: actions/checkout@v6 |
| 111 | + with: |
| 112 | + fetch-depth: 0 |
| 113 | + submodules: true |
| 114 | + |
| 115 | + - name: Configure github-actions bot |
| 116 | + run: | |
| 117 | + git config user.name "github-actions[bot]" |
| 118 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 119 | +
|
| 120 | + - name: Rebase release/macos |
| 121 | + run: | |
| 122 | + git checkout release/macos |
| 123 | + git submodule update --init --recursive |
| 124 | + git submodule foreach ' |
| 125 | + git fetch --all |
| 126 | + main=$(git remote show origin | awk "/HEAD branch/ {print \$NF}") |
| 127 | + git checkout $main |
| 128 | + git pull |
| 129 | + ' |
| 130 | + git reset --hard origin/feature/macos/trunk |
| 131 | + git merge --no-edit origin/feature/performance/trunk |
| 132 | + git submodule add https://github.com/TritonDataCenter/pkgsrc-extra.git extra |
| 133 | + git add .gitmodules |
| 134 | + git commit -m "Add submodules." |
| 135 | + if [ "$(git rev-parse HEAD^{tree})" = "$(git rev-parse origin/release/macos^{tree})" ]; then |
| 136 | + echo "No upstream changes, skipping push." |
| 137 | + exit 0 |
| 138 | + fi |
| 139 | + git push --force origin release/macos |
0 commit comments