Testing new build stuff #20
Workflow file for this run
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: Release Dry Run | |
| on: | |
| push: | |
| branches: [ split_server_client_binaries ] | |
| workflow_dispatch: | |
| inputs: | |
| note: | |
| description: "Build all release artifacts without publishing (admins/maintainers only)" | |
| required: false | |
| default: "" | |
| jobs: | |
| check-permissions: | |
| name: Check permissions | |
| runs-on: ubuntu-latest | |
| outputs: | |
| allowed: ${{ steps.check.outputs.allowed }} | |
| level: ${{ steps.check.outputs.level }} | |
| steps: | |
| - name: Check collaborator permission level | |
| id: check | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const {owner, repo} = context.repo; | |
| const username = context.actor; | |
| const resp = await github.rest.repos.getCollaboratorPermissionLevel({ owner, repo, username }); | |
| const perm = resp.data.permission; // 'admin' | 'maintain' | 'write' | 'triage' | 'read' | 'none' | |
| const allowed = ['admin','maintain'].includes(perm); | |
| core.info(`Actor ${username} permission: ${perm}. Allowed: ${allowed}`); | |
| core.setOutput('allowed', allowed ? 'true' : 'false'); | |
| core.setOutput('level', perm); | |
| release-dry-run: | |
| name: GoReleaser (dry run) | |
| needs: check-permissions | |
| if: needs.check-permissions.outputs.allowed == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Install cross toolchains and libc headers (Linux CGO) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu \ | |
| libc6-dev-armhf-cross libc6-dev-arm64-cross \ | |
| linux-libc-dev-armhf-cross linux-libc-dev-arm64-cross | |
| - name: Run GoReleaser (skip publish, snapshot) | |
| uses: goreleaser/goreleaser-action@v5 | |
| with: | |
| distribution: goreleaser | |
| version: latest | |
| args: release --verbose --skip-publish --skip-sign --snapshot --clean --config .github/goreleaser.yml | |
| env: | |
| CGO_ENABLED: 1 | |
| deny: | |
| name: Deny unauthorized | |
| needs: check-permissions | |
| if: needs.check-permissions.outputs.allowed != 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Stop | |
| run: | | |
| echo "User '${{ github.actor }}' lacks required permission (need admin or maintain). Current: ${{ needs.check-permissions.outputs.level }}" | |
| exit 1 | |