fix: ending bits of lists #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build SideBackup | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| tags: | |
| - '*.*.*' | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| branches: | |
| - '**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.base_ref || github.ref_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false) || (github.ref_name == 'main' || github.ref_name == 'develop') | |
| name: Build and Archive | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Xcode | |
| uses: maxim-lobanov/setup-xcode@v1.6.0 | |
| with: | |
| xcode-version: latest-stable | |
| - name: Set Up Xcode Cache | |
| uses: irgaly/xcode-cache@v1.9.2 | |
| with: | |
| key: xcode-cache-deriveddata-${{ github.base_ref || github.ref_name }} | |
| restore-keys: xcode-cache-dereviddata-${{ github.base_ref || github.ref_name }} | |
| - name: Build | |
| id: build | |
| run: ./.github/makeipa | |
| - name: Upload Release | |
| if: github.ref_type == 'tag' | |
| uses: softprops/action-gh-release@v2.5.0 | |
| with: | |
| files: | | |
| build/${{ steps.build.outputs.log }} | |
| build/${{ steps.build.outputs.sym }} | |
| build/${{ steps.build.outputs.ipa }} | |
| draft: true | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload nightly | |
| if: github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'develop') | |
| uses: altemiq/update-existing-release@v1.3.5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| release: nightly | |
| tag: nightly | |
| replace: true | |
| prerelease: true | |
| files: > | |
| build/${{ steps.build.outputs.log }} | |
| build/${{ steps.build.outputs.sym }} | |
| build/${{ steps.build.outputs.ipa }} | |
| body: | | |
| Automated nightly build from commit ${{ github.sha }} | |
| **Branch:** ${{ github.ref_name }} | |
| **Commit:** ${{ github.event.head_commit.message }} | |
| **Built:** ${{ github.event.head_commit.timestamp }} | |
| - name: Upload IPA | |
| if: github.event_name == 'pull_request' && github.event.pull_request.draft == false | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ steps.build.outputs.ipa }} | |
| path: build/${{ steps.build.outputs.ipa }} | |
| compression-level: 0 | |
| - name: Upload Build Log | |
| if: github.event_name == 'pull_request' && github.event.pull_request.draft == false | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ steps.build.outputs.log }} | |
| path: build/${{ steps.build.outputs.log }} | |
| compression-level: 0 | |
| - name: Upload dSYM | |
| if: github.event_name == 'pull_request' && github.event.pull_request.draft == false | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ steps.build.outputs.sym }} | |
| path: build/${{ steps.build.outputs.sym }} | |
| compression-level: 0 | |
| - name: Upload PR Comment | |
| uses: actions/github-script@v8 | |
| if: github.event_name == 'pull_request' && github.event.pull_request.draft == false | |
| with: | |
| # This snippet is public-domain, taken from | |
| # https://github.com/oprypin/nightly.link/blob/master/.github/workflows/pr-comment.yml | |
| # slightly modified by nythepegasus | |
| 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.run_id }}; | |
| 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); | |
| await upsertComment(owner, repo, ${{ github.event.pull_request.number }}, "nightly-link", body); |