.github/workflows: downscope permissions where possible

This commit is contained in:
Filippo Valsorda
2021-09-10 11:38:48 +02:00
parent 8d88096476
commit 427edf35cc
5 changed files with 48 additions and 8 deletions
+17 -4
View File
@@ -1,12 +1,14 @@
name: Build and upload binaries
on:
release:
types: [published]
push:
pull_request:
name: Build binaries
permissions:
contents: read
jobs:
binaries:
name: Build and upload
build:
name: Build binaries
runs-on: ubuntu-latest
steps:
- name: Install Go
@@ -47,9 +49,20 @@ jobs:
with:
name: age-binaries
path: age-*
upload:
name: Upload release binaries
if: ${{ github.event_name == 'release' }}
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Download workflow artifacts
uses: actions/download-artifact@v2
with:
name: age-binaries
- name: Upload release artifacts
uses: actions/github-script@v3
if: ${{ github.event_name == 'release' }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |