Skip to content

Commit

Permalink
fix(ci): Manage secrets/permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoref committed Feb 27, 2023
1 parent e1bd3ef commit 827ea04
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
25 changes: 24 additions & 1 deletion .github/workflows/ci_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,29 @@ on:
- master

jobs:
config:
runs-on: "ubuntu-latest"
permissions:
contents: none
outputs:
has-secrets: ${{ steps.check.outputs.has-secrets }}
steps:
- name: "Check for secrets"
id: check
shell: bash
run: |
if [ -n "${{ (secrets.REPO_GPG_PASSPHRASE != '' && secrets.NIGHTLY_KEYCHAIN_PASSPHRASE != '') || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
fi
build:
needs: config
if: needs.config.outputs.has-secrets
name: Build and Sign

runs-on: macos-12
permissions:
contents: read
env:
IS_CI: 1
IS_NIGHTLY: 1
Expand Down Expand Up @@ -114,5 +133,9 @@ jobs:
path: archive/${{ steps.version.outputs.NIGHTLY_VERSION }}/Release-build.log

- name: Send notification
if: env.CI_WEBHOOK_URL != '' && env.CI_WEBHOOK_SECRET != ''
env:
CI_WEBHOOK_URL: ${{ secrets.CI_WEBHOOK_URL }}
CI_WEBHOOK_SECRET: ${{ secrets.CI_WEBHOOK_SECRET }}
run: |
/usr/bin/curl -H "X-CI-WebHook: true" -H "Content-Type: application/json" -d '{"secret": "${{ secrets.CI_WEBHOOK_SECRET }}", "repository": "hammerspoon", "workflow": "Dev Build", "message": "New development build: ${{ steps.version.outputs.NIGHTLY_VERSION }}"}' ${{ secrets.CI_WEBHOOK_URL }}
/usr/bin/curl -H "X-CI-WebHook: true" -H "Content-Type: application/json" -d '{"secret": "$CI_WEBHOOK_SECRET", "repository": "hammerspoon", "workflow": "Dev Build", "message": "New development build: ${{ steps.version.outputs.NIGHTLY_VERSION }}"}' $CI_WEBHOOK_URL
2 changes: 2 additions & 0 deletions .github/workflows/ci_testbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
build:
name: Build and Test
runs-on: macos-12
permissions:
contents: read
env:
IS_CI: 1

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci_testbuild_results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ jobs:
publish:
name: "Process CI Results"
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write

if: always()

steps:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/new_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
generate-release-notes:
name: Generate Release Notes
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -52,6 +54,9 @@ jobs:
create-next-milestone:
name: Create next milestone
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@v2
with:
Expand Down

0 comments on commit 827ea04

Please sign in to comment.