Skip to content

Commit 5562307

Browse files
committed
release: add permissions and prereqs
Add required permissions for federated credentials [1] to the release workflow. Additionally, add a prereqs job to set the GCM version for the workflow. 1: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure#adding-permissions-settings
1 parent 531d7ed commit 5562307

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,23 @@ name: release
33
on:
44
workflow_dispatch:
55

6+
permissions:
7+
id-token: write
8+
contents: write
9+
610
jobs:
11+
prereqs:
12+
name: Prerequisites
13+
runs-on: ubuntu-latest
14+
outputs:
15+
version: ${{ steps.version.outputs.version }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set version
20+
run: echo "version=$(cat VERSION | sed -E 's/.[0-9]+$//')" >> $GITHUB_OUTPUT
21+
id: version
22+
723
# ================================
824
# macOS
925
# ================================
@@ -698,15 +714,10 @@ jobs:
698714
name: Publish GitHub draft release
699715
runs-on: ubuntu-latest
700716
environment: release
701-
needs: [ validate ]
717+
needs: [ prereqs, validate ]
702718
steps:
703719
- uses: actions/checkout@v4
704720

705-
- name: Set version environment variable
706-
run: |
707-
# Remove the "revision" portion of the version
708-
echo "VERSION=$(cat VERSION | sed -E 's/.[0-9]+$//')" >> $GITHUB_ENV
709-
710721
- name: Set up .NET
711722
uses: actions/[email protected]
712723
with:
@@ -736,7 +747,7 @@ jobs:
736747
script: |
737748
const fs = require('fs');
738749
const path = require('path');
739-
const version = process.env.VERSION
750+
const version = "${{ needs.prereqs.outputs.version }}"
740751
741752
var releaseMetadata = {
742753
owner: context.repo.owner,

0 commit comments

Comments
 (0)