|
1 | 1 | # Build and publish a release of OpenGamepadUI using semantic-release whenever |
2 | 2 | # changes are merged into main. |
3 | | -name: "Release" |
| 3 | +name: "🎉 Release" |
4 | 4 |
|
5 | 5 | on: |
6 | 6 | push: |
|
18 | 18 | # Jobs to run |
19 | 19 | jobs: |
20 | 20 | release: |
| 21 | + name: 🎉 Publish to GitHub |
21 | 22 | runs-on: ubuntu-latest |
22 | 23 |
|
23 | 24 | steps: |
|
46 | 47 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
47 | 48 | run: make release |
48 | 49 |
|
| 50 | + # In ".releaserc.yaml" a step is defined to write the release version to |
| 51 | + # ".version.txt" upon successful release. This step checks to see if that |
| 52 | + # exists to determine if the other jobs need to run. |
| 53 | + - id: status |
| 54 | + name: Set release status |
| 55 | + shell: bash |
| 56 | + run: | |
| 57 | + if [ -f .version.txt ]; then |
| 58 | + echo "was_released=yes" >> "$GITHUB_OUTPUT" |
| 59 | + else |
| 60 | + echo "was_released=no" >> "$GITHUB_OUTPUT" |
| 61 | + fi |
| 62 | +
|
| 63 | + # Upload the package build for the AUR publish step |
| 64 | + - name: Upload PKGBUILD |
| 65 | + uses: actions/upload-artifact@v4 |
| 66 | + if: steps.status.outputs.was_released == 'yes' |
| 67 | + with: |
| 68 | + name: PKGBUILD |
| 69 | + path: ./package/archlinux/PKGBUILD |
| 70 | + if-no-files-found: error |
| 71 | + - name: Upload Release Version |
| 72 | + uses: actions/upload-artifact@v4 |
| 73 | + if: steps.status.outputs.was_released == 'yes' |
| 74 | + with: |
| 75 | + name: version.txt |
| 76 | + path: .version.txt |
| 77 | + if-no-files-found: error |
| 78 | + include-hidden-files: true |
| 79 | + |
| 80 | + outputs: |
| 81 | + should_publish: ${{ steps.status.outputs.was_released }} |
| 82 | + |
| 83 | + publish-docs: |
| 84 | + name: 📔 Publish documentation |
| 85 | + needs: release |
| 86 | + if: needs.release.outputs.should_publish == 'yes' |
| 87 | + runs-on: ubuntu-latest |
| 88 | + |
| 89 | + steps: |
49 | 90 | - name: Trigger documentation generation |
50 | 91 | run: | |
51 | 92 | curl -L -X POST \ |
|
54 | 95 | -H "X-GitHub-Api-Version: 2022-11-28" \ |
55 | 96 | https://api.github.com/repos/ShadowBlip/OpenGamepadUI/dispatches \ |
56 | 97 | --data '{"event_type": "Trigger Workflow", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}' |
| 98 | +
|
| 99 | + publish-to-aur: |
| 100 | + name: 🐧 Publish to AUR |
| 101 | + needs: release |
| 102 | + if: needs.release.outputs.should_publish == 'yes' |
| 103 | + runs-on: ubuntu-latest |
| 104 | + |
| 105 | + steps: |
| 106 | + - name: Download PKGBUILD |
| 107 | + uses: actions/download-artifact@v4 |
| 108 | + with: |
| 109 | + name: PKGBUILD |
| 110 | + |
| 111 | + - name: Download Release Version |
| 112 | + uses: actions/download-artifact@v4 |
| 113 | + with: |
| 114 | + name: version.txt |
| 115 | + |
| 116 | + - name: Setup SSH |
| 117 | + uses: MrSquaare/ssh-setup-action@v3 |
| 118 | + with: |
| 119 | + host: aur.archlinux.org |
| 120 | + private-key: ${{ secrets.AUR_SSH_KEY }} |
| 121 | + |
| 122 | + - name: Checkout AUR bin |
| 123 | + run: git clone ssh://[email protected]/opengamepadui-bin.git |
| 124 | + |
| 125 | + - name: Copy PKGBUILD to bin repo |
| 126 | + run: cp ./PKGBUILD opengamepadui-bin/ |
| 127 | + |
| 128 | + - name: Build bin package |
| 129 | + working-directory: opengamepadui-bin |
| 130 | + run: make in-docker |
| 131 | + |
| 132 | + - name: Commit and publish bin package |
| 133 | + shell: bash |
| 134 | + working-directory: opengamepadui-bin |
| 135 | + run: | |
| 136 | + git config user.name "github-actions[bot]" |
| 137 | + git config user.email "shadowblip+github-actions[bot]@users.noreply.github.com" |
| 138 | + git add .SRCINFO PKGBUILD |
| 139 | + git commit -m "Update to $(grep '^pkgver=' PKGBUILD | cut -d'=' -f2)" |
| 140 | + git push origin master |
0 commit comments