|
| 1 | +name: Publish QPM Package |
| 2 | + |
| 3 | +env: |
| 4 | + ndkname: android-ndk-r22 |
| 5 | + module_id: scoresaber |
| 6 | + qmodName: ScoreSaber |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + tags: |
| 11 | + - 'v*' |
| 12 | + |
| 13 | +jobs: |
| 14 | + publish: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v2 |
| 19 | + name: Checkout |
| 20 | + with: |
| 21 | + submodules: true |
| 22 | + lfs: true |
| 23 | + |
| 24 | + - uses: seanmiddleditch/gha-setup-ninja@v3 |
| 25 | + |
| 26 | + - name: Create ndkpath.txt |
| 27 | + run: | |
| 28 | + echo "$ANDROID_NDK_LATEST_HOME" > ${GITHUB_WORKSPACE}/ndkpath.txt |
| 29 | + cat ${GITHUB_WORKSPACE}/ndkpath.txt |
| 30 | +
|
| 31 | + - name: Get QPM |
| 32 | + if: steps.cache-qpm.outputs.cache-hit != 'true' |
| 33 | + uses: dawidd6/action-download-artifact@v2 |
| 34 | + with: |
| 35 | + github_token: ${{secrets.GITHUB_TOKEN}} |
| 36 | + workflow: cargo-build.yml |
| 37 | + name: linux-qpm-rust |
| 38 | + path: QPM |
| 39 | + repo: RedBrumbler/QuestPackageManager-Rust |
| 40 | + |
| 41 | + - name: QPM Collapse |
| 42 | + run: | |
| 43 | + chmod +x ./QPM/qpm-rust |
| 44 | + ./QPM/qpm-rust collapse |
| 45 | +
|
| 46 | + - name: QPM Dependencies Cache |
| 47 | + id: cache-qpm-deps |
| 48 | + uses: actions/cache@v2 |
| 49 | + env: |
| 50 | + cache-name: cache-qpm-deps |
| 51 | + with: |
| 52 | + path: /home/runner/.local/share/QPM-Rust/cache |
| 53 | + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('qpm.json') }} |
| 54 | + restore-keys: | |
| 55 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 56 | + ${{ runner.os }}-build- |
| 57 | + ${{ runner.os }}- |
| 58 | +
|
| 59 | + - name: QPM Restore |
| 60 | + run: | |
| 61 | + ./QPM/qpm-rust restore |
| 62 | +
|
| 63 | + - name: List Post Restore |
| 64 | + run: | |
| 65 | + echo includes: |
| 66 | + ls -la ${GITHUB_WORKSPACE}/extern/includes |
| 67 | + echo libs: |
| 68 | + ls -la ${GITHUB_WORKSPACE}/extern/libs |
| 69 | + echo cache: |
| 70 | + ls -la $HOME/.local/share/QPM-Rust/cache |
| 71 | +
|
| 72 | + - name: Get Tag Version |
| 73 | + id: get_tag_version |
| 74 | + run: | |
| 75 | + echo ${GITHUB_REF#refs/tags/} |
| 76 | + echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} |
| 77 | + echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v} |
| 78 | +
|
| 79 | + - name: QPM Edit Version |
| 80 | + run: | |
| 81 | + ./QPM/qpm-rust package edit --version "${{ steps.get_tag_version.outputs.VERSION }}" |
| 82 | +
|
| 83 | + - name: Apply Legacy fix |
| 84 | + run: | |
| 85 | + ./QPM/qpm-rust cache legacy-fix |
| 86 | +
|
| 87 | + - name: Build |
| 88 | + run: | |
| 89 | + cd ${GITHUB_WORKSPACE} |
| 90 | + ./QPM/qpm-rust qmod build --include_libs "lib${module_id}.so" |
| 91 | + pwsh -Command ./build.ps1 |
| 92 | +
|
| 93 | + - name: Create Qmod |
| 94 | + run: | |
| 95 | + pwsh -Command ./createqmod.ps1 ${{env.qmodName}} |
| 96 | +
|
| 97 | + # Commit the change to the package, .vscode/c_cpp_properties.json, and Android.mk |
| 98 | + - name: Configure commit |
| 99 | + run: | |
| 100 | + git config user.name "Github Actions" |
| 101 | + git config user.email "<>" |
| 102 | + - name: Commit Edit Version |
| 103 | + run: | |
| 104 | + git add ./qpm.json |
| 105 | + git commit -m "Update Version and post restore" --allow-empty |
| 106 | + # Then, we want to use the commit we have just made, and force push our tag to that commit |
| 107 | + - name: Get Commit ID |
| 108 | + id: get_commit_id |
| 109 | + run: | |
| 110 | + echo `git rev-parse HEAD` |
| 111 | + echo ::set-output name=ID::`git rev-parse HEAD` |
| 112 | + - name: Force create tag |
| 113 | + run: | |
| 114 | + git tag --force ${{ steps.get_tag_version.outputs.TAG }} ${{ steps.get_commid_id.outputs.ID }} |
| 115 | + # Then, push, upload our artifacts, modify the config file to have soLink and debugSoLink |
| 116 | + - name: Create and push version specific branch |
| 117 | + env: |
| 118 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 119 | + run: | |
| 120 | + git branch version-${{ steps.get_tag_version.outputs.TAG }} |
| 121 | + git push -u origin version-${{ steps.get_tag_version.outputs.TAG }} --force --tags |
| 122 | + # Get release that was created for this tag |
| 123 | + - name: Get Release |
| 124 | + |
| 125 | + id: get_release |
| 126 | + with: |
| 127 | + route: GET /repos/:repository/releases/tags/${{ steps.get_tag_version.outputs.TAG }} |
| 128 | + repository: ${{ github.repository }} |
| 129 | + env: |
| 130 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 131 | + |
| 132 | + - name: Get Release Upload URL |
| 133 | + id: get_upload_url |
| 134 | + run: | |
| 135 | + url=$(echo "$response" | jq -r '.upload_url') |
| 136 | + echo $url |
| 137 | + echo "::set-output name=upload_url::$url" |
| 138 | + env: |
| 139 | + response: ${{ steps.get_release.outputs.data }} |
| 140 | + |
| 141 | + - name: Get Library Name |
| 142 | + id: libname |
| 143 | + run: | |
| 144 | + cd ./build/ |
| 145 | + pattern="lib${module_id}*.so" |
| 146 | + files=( $pattern ) |
| 147 | + echo ::set-output name=NAME::"${files[0]}" |
| 148 | +
|
| 149 | + # Upload our release assets |
| 150 | + - name: Upload Release Asset |
| 151 | + id: upload_release_asset |
| 152 | + uses: actions/upload-release-asset@v1 |
| 153 | + env: |
| 154 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 155 | + with: |
| 156 | + upload_url: ${{ steps.get_upload_url.outputs.upload_url }} |
| 157 | + asset_path: ./build/${{ steps.libname.outputs.NAME }} |
| 158 | + asset_name: ${{ steps.libname.outputs.NAME }} |
| 159 | + asset_content_type: application/octet-stream |
| 160 | + |
| 161 | + - name: Upload Debug Asset |
| 162 | + id: upload_debug_asset |
| 163 | + uses: actions/upload-release-asset@v1 |
| 164 | + env: |
| 165 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 166 | + with: |
| 167 | + upload_url: ${{ steps.get_upload_url.outputs.upload_url }} |
| 168 | + asset_path: ./build/debug_${{ steps.libname.outputs.NAME }} |
| 169 | + asset_name: debug_${{ steps.libname.outputs.NAME }} |
| 170 | + asset_content_type: application/octet-stream |
| 171 | + |
| 172 | + - name: Upload Qmod asset |
| 173 | + id: upload_qmod_asset |
| 174 | + uses: actions/upload-release-asset@v1 |
| 175 | + env: |
| 176 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 177 | + with: |
| 178 | + upload_url: ${{ steps.get_upload_url.outputs.upload_url }} |
| 179 | + asset_path: ./${{ env.qmodName }}.qmod |
| 180 | + asset_name: ${{ env.qmodName }}.qmod |
| 181 | + asset_content_type: application/octet-stream |
| 182 | + |
| 183 | + - name: Change QPM Package Info |
| 184 | + run: | |
| 185 | + ./QPM/qpm-rust package edit-extra --branchName "version-${{ steps.get_tag_version.outputs.TAG }}" |
| 186 | + ./QPM/qpm-rust package edit-extra --soLink "${{ steps.upload_release_asset.outputs.browser_download_url }}" |
| 187 | + ./QPM/qpm-rust package edit-extra --debugSoLink "${{ steps.upload_debug_asset.outputs.browser_download_url }}" |
| 188 | + ./QPM/qpm-rust package edit-extra --modLink "${{ steps.upload_qmod_asset.outputs.browser_download_url }}" |
| 189 | +
|
| 190 | + - name: Commit Changed package info |
| 191 | + run: | |
| 192 | + git add qpm.json |
| 193 | + git commit -m "Updated qpm.json" |
| 194 | +
|
| 195 | + # Then, we want to use the commit we have just made, and force push our tag to that commit |
| 196 | + - name: Get Commit ID |
| 197 | + id: get_created_commit_id |
| 198 | + run: | |
| 199 | + echo `git rev-parse HEAD` |
| 200 | + echo ::set-output name=ID::`git rev-parse HEAD` |
| 201 | +
|
| 202 | + - name: Push New Commit and Tag |
| 203 | + run: | |
| 204 | + git push origin HEAD:version-${{ steps.get_tag_version.outputs.TAG }} --force |
| 205 | + git tag --force ${{ steps.get_tag_version.outputs.TAG }} ${{ steps.get_created_commit_id.outputs.ID }} |
| 206 | + git push --tags --force |
| 207 | +
|
| 208 | +# - name: Merge this branch into whatever branch we were originally built off of. |
| 209 | +# TODO |
| 210 | +# Not a Package |
| 211 | +# - name: QPM Publish |
| 212 | +# run: ./QPM/qpm-rust publish |
0 commit comments