diff options
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/build.yml | 38 | ||||
-rw-r--r-- | .github/workflows/pr-comment.yml | 61 | ||||
-rw-r--r-- | .github/workflows/trigger_builds.yml | 10 |
3 files changed, 98 insertions, 11 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3e8681c9..b011a779 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,12 @@ jobs: qt_host: linux - os: ubuntu-20.04 + name: Linux-Portable + qt_version: 5.12.8 + qt_host: linux + portable: true + + - os: ubuntu-20.04 qt_version: 5.15.2 qt_host: linux app_image: true @@ -140,7 +146,6 @@ jobs: run: | cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DLauncher_PORTABLE=OFF -G Ninja - - name: Configure CMake on Windows portable if: runner.os == 'Windows' && matrix.portable == true shell: msys2 {0} @@ -148,10 +153,15 @@ jobs: cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -G Ninja - name: Configure CMake on Linux - if: runner.os == 'Linux' + if: runner.os == 'Linux' && matrix.portable != true run: | cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DLauncher_PORTABLE=OFF -G Ninja + - name: Configure CMake on Linux Portable + if: runner.os == 'Linux' && matrix.portable == true + run: | + cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -G Ninja + - name: Build if: runner.os != 'Windows' run: | @@ -175,10 +185,15 @@ jobs: cmake --install ${{ env.BUILD_DIR }} - name: Install on Linux - if: runner.os == 'Linux' + if: runner.os == 'Linux' && matrix.portable != true run: | DESTDIR=${{ env.INSTALL_DIR }} cmake --install ${{ env.BUILD_DIR }} + - name: Install on Linux portable + if: runner.os == 'Linux' && matrix.portable == true + run: | + cmake --install ${{ env.BUILD_DIR }} + - name: Bundle AppImage if: matrix.app_image == true shell: bash @@ -219,18 +234,31 @@ jobs: tar -czf ../PolyMC.tar.gz * - name: tar on Linux - if: runner.os == 'Linux' && matrix.app_image != true + if: runner.os == 'Linux' && matrix.app_image != true && matrix.portable != true run: | cd ${{ env.INSTALL_DIR }} tar -czf ../PolyMC.tar.gz * + - name: tar on Linux portable + if: runner.os == 'Linux' && matrix.app_image != true && matrix.portable == true + run: | + cd ${{ env.INSTALL_DIR }} + tar -czf ../PolyMC-portable.tar.gz * + - name: Upload Linux tar.gz - if: runner.os == 'Linux' && matrix.app_image != true + if: runner.os == 'Linux' && matrix.app_image != true && matrix.portable != true uses: actions/upload-artifact@v3 with: name: PolyMC-${{ runner.os }}-${{ env.VERSION }}-${{ inputs.build_type }} path: PolyMC.tar.gz + - name: Upload Linux Portable tar.gz + if: runner.os == 'Linux' && matrix.app_image != true && matrix.portable == true + uses: actions/upload-artifact@v3 + with: + name: PolyMC-${{ runner.os }}-Portable-${{ env.VERSION }}-${{ inputs.build_type }} + path: PolyMC-portable.tar.gz + - name: Upload AppImage for Linux if: matrix.app_image == true uses: actions/upload-artifact@v3 diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml new file mode 100644 index 00000000..7e8e4d99 --- /dev/null +++ b/.github/workflows/pr-comment.yml @@ -0,0 +1,61 @@ +name: Comment on pull request +on: + workflow_run: + workflows: ['Test workflow with upload'] + types: [completed] +jobs: + pr_comment: + if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v5 + with: + # This snippet is public-domain, taken from + # https://github.com/oprypin/nightly.link/blob/master/.github/workflows/pr-comment.yml + script: | + async function upsertComment(owner, repo, issue_number, purpose, body) { + const {data: comments} = await github.rest.issues.listComments( + {owner, repo, issue_number}); + + const marker = `<!-- bot: ${purpose} -->`; + body = marker + "\n" + body; + + const existing = comments.filter((c) => c.body.includes(marker)); + if (existing.length > 0) { + const last = existing[existing.length - 1]; + core.info(`Updating comment ${last.id}`); + await github.rest.issues.updateComment({ + owner, repo, + body, + comment_id: last.id, + }); + } else { + core.info(`Creating a comment in issue / PR #${issue_number}`); + await github.rest.issues.createComment({issue_number, body, owner, repo}); + } + } + + const {owner, repo} = context.repo; + const run_id = ${{github.event.workflow_run.id}}; + + const pull_requests = ${{ toJSON(github.event.workflow_run.pull_requests) }}; + if (!pull_requests.length) { + return core.error("This workflow doesn't match any pull requests!"); + } + + const artifacts = await github.paginate( + github.rest.actions.listWorkflowRunArtifacts, {owner, repo, run_id}); + if (!artifacts.length) { + return core.error(`No artifacts found`); + } + let body = `Download the artifacts for this pull request:\n`; + for (const art of artifacts) { + body += `\n* [${art.name}.zip](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`; + } + + core.info("Review thread message body:", body); + + for (const pr of pull_requests) { + await upsertComment(owner, repo, pr.number, + "nightly-link", body); + } diff --git a/.github/workflows/trigger_builds.yml b/.github/workflows/trigger_builds.yml index 1561b9d6..3ec6bb95 100644 --- a/.github/workflows/trigger_builds.yml +++ b/.github/workflows/trigger_builds.yml @@ -9,12 +9,16 @@ on: - '**/LICENSE' - 'flake.lock' - '**.nix' + - 'packages/**' + - '.github/ISSUE_TEMPLATE/**' pull_request: paths-ignore: - '**.md' - '**/LICENSE' - 'flake.lock' - '**.nix' + - 'packages/**' + - '.github/ISSUE_TEMPLATE/**' workflow_dispatch: jobs: @@ -24,9 +28,3 @@ jobs: uses: ./.github/workflows/build.yml with: build_type: Debug - - build_release: - name: Build Release - uses: ./.github/workflows/build.yml - with: - build_type: Release |