|
| 1 | +name: CD | Dev Release |
| 2 | + |
| 3 | +# Performs the task of merging from master to the dev-release branch. |
| 4 | +# Pings the server to pull an update once the dev-release branch has been merged. |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [master] |
| 9 | + |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + |
| 14 | + merge: |
| 15 | + name: master -> master-ci |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + |
| 21 | + - name: Wait on check |
| 22 | + uses: fountainhead/action-wait-for-check@v1.1.0 |
| 23 | + id: wait-for-build |
| 24 | + |
| 25 | + with: |
| 26 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + checkName: build |
| 28 | + ref: ${{ github.event.pull_request.head.sha || github.sha }} |
| 29 | + |
| 30 | + - name: Create Pull Request |
| 31 | + |
| 32 | + if: steps.wait-for-build.outputs.conclusion == 'success' |
| 33 | + uses: repo-sync/pull-request@v2 |
| 34 | + with: |
| 35 | + destination_branch: "master-ci" |
| 36 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 37 | + |
| 38 | + - name: Merge master -> master-ci |
| 39 | + |
| 40 | + if: steps.wait-for-build.outputs.conclusion == 'success' |
| 41 | + uses: devmasx/merge-branch@1.4.0 |
| 42 | + with: |
| 43 | + type: now |
| 44 | + target_branch: master-ci |
| 45 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + # master-ci -> dev-release |
| 50 | + sanitize: |
| 51 | + name: master-ci -> dev-release |
| 52 | + runs-on: ubuntu-latest |
| 53 | + |
| 54 | + steps: |
| 55 | + - name: Checkout master-ci |
| 56 | + uses: actions/checkout@v3 |
| 57 | + with: |
| 58 | + ref: master-ci |
| 59 | + fetch-depth: 0 |
| 60 | + |
| 61 | + - name: Wait on Merge |
| 62 | + uses: fountainhead/action-wait-for-check@v1.1.0 |
| 63 | + id: wait-for-merge |
| 64 | + with: |
| 65 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + checkName: master -> master-ci |
| 67 | + ref: ${{ github.event.pull_request.head.sha || github.sha }} |
| 68 | + |
| 69 | + - name: Checkout dev-release |
| 70 | + uses: actions/checkout@v3 |
| 71 | + with: |
| 72 | + ref: dev-release |
| 73 | + fetch-depth: 0 |
| 74 | + |
| 75 | + - name: Remove Bloat |
| 76 | + id: remove-bloat |
| 77 | + if: steps.wait-for-merge.outputs.conclusion == 'success' |
| 78 | + run: | |
| 79 | + git config user.name github-actions |
| 80 | + git config user.email github-actions@github.com |
| 81 | +
|
| 82 | + git checkout dev-release |
| 83 | + git pull origin dev-release |
| 84 | +
|
| 85 | + git merge origin/master-ci |
| 86 | +
|
| 87 | + rm -rf LICENSE |
| 88 | + rm -rf README.md |
| 89 | + rm -rf docs |
| 90 | + rm -rf tests |
| 91 | +
|
| 92 | + git add . |
| 93 | +
|
| 94 | + git diff-index --quiet HEAD || git commit -m "Merge master-ci into dev-release and remove unnecessary files" |
| 95 | +
|
| 96 | + git push origin dev-release |
| 97 | +
|
| 98 | + - name: Webhook |
| 99 | + uses: distributhor/workflow-webhook@v3 |
| 100 | + env: |
| 101 | + webhook_url: "https://dev.recursion.space/webhooks/github/" |
| 102 | + webhook_secret: "Y0uR5ecr3t" |
0 commit comments