44 branches :
55 - main
66
7+ permissions : {}
8+
79jobs :
810 npm-publish :
911 name : Publish to NPM & GitHub Package Registry
1012 runs-on : ubuntu-latest
13+ permissions :
14+ contents : read
15+ packages : write
1116 outputs :
1217 new_version : ${{ steps.version_check.outputs.version }}
1318 version_changed : ${{ steps.version_check.outputs.changed }}
@@ -16,17 +21,21 @@ jobs:
1621 uses : actions/checkout@v4
1722 with :
1823 ref : main
24+ persist-credentials : false
1925 # limit releases to version changes - https://github.com/EndBug/version-check
2026 - name : Check version changes
21- uses : EndBug/version-check@v2
27+ uses : EndBug/version-check@36ff30f37c7deabe56a30caa043d127be658c425 # v2.1.5
2228 id : version_check
2329 with :
2430 file-url : https://unpkg.com/@grafana/aws-sdk@latest/package.json
2531 static-checking : localIsNew
2632
2733 - name : Version update detected
34+ env :
35+ VERSION : ${{ steps.version_check.outputs.version }}
36+ TYPE : ${{ steps.version_check.outputs.type }}
2837 if : steps.version_check.outputs.changed == 'true'
29- run : ' echo "Version change found! New version: ${{ steps.version_check.outputs.version }} (${{ steps.version_check.outputs.type } })"'
38+ run : ' echo "Version change found! New version: ${VERSION} (${TYPE })"'
3039
3140 - name : Setup .npmrc file for NPM registry
3241 if : steps.version_check.outputs.changed == 'true'
@@ -67,16 +76,23 @@ jobs:
6776 runs-on : ubuntu-latest
6877 needs : npm-publish
6978 if : needs.npm-publish.outputs.version_changed == 'true'
79+ permissions :
80+ contents : write
7081 steps :
7182 - name : Checkout code
7283 uses : actions/checkout@v4
84+ with :
85+ persist-credentials : false
7386
7487 - name : Create Release Notes
758889+ env :
90+ TAG_NAME : " v${{ needs.npm-publish.outputs.new_version }}"
7691 with :
7792 github-token : ${{ secrets.GITHUB_TOKEN }}
7893 script : |
94+ const { TAG_NAME } = process.env
7995 await github.request(`POST /repos/${{ github.repository }}/releases`, {
80- tag_name: "v${{ needs.npm-publish.outputs.new_version }}" ,
96+ tag_name: `${TAG_NAME}` ,
8197 generate_release_notes: true
8298 });
0 commit comments