Skip to content

Commit bad8bcf

Browse files
authored
fix: support packaging on protected branches (#541)
1 parent f468b7f commit bad8bcf

File tree

1 file changed

+41
-19
lines changed

1 file changed

+41
-19
lines changed

.github/workflows/package.yml

+41-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,49 @@
1+
name: Update dist files on
2+
13
on:
24
push:
35
branches:
46
- master
5-
6-
name: Package
7+
- v1-node16
8+
paths-ignore:
9+
- 'dist/**'
710

811
jobs:
9-
check:
10-
name: Package distribution file
12+
package:
13+
name: Package dist files
1114
runs-on: ubuntu-latest
15+
permissions:
16+
id-token: write
17+
contents: read
1218
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v2
15-
with:
16-
ref: master
17-
- name: Package
18-
run: |
19-
npm ci
20-
npm test
21-
npm run package
22-
- name: Commit
23-
run: |
24-
git config --global user.name "GitHub Actions"
25-
git add dist/
26-
git commit -m "chore: Update dist" || echo "No changes to commit"
27-
git push origin HEAD:master
19+
- name: Configure AWS credentials
20+
uses: aws-actions/configure-aws-credentials@v1-node16
21+
with:
22+
aws-region: us-west-2
23+
role-to-assume: ${{ secrets.SECRETS_AWS_ROLE_TO_ASSUME }}
24+
role-duration-seconds: 900
25+
role-session-name: SecretsManagerFetch
26+
- name: Get bot user token
27+
uses: aws-actions/aws-secretsmanager-get-secrets@v1
28+
with:
29+
parse-json-secrets: true
30+
secret-ids: |
31+
OSDS,arn:aws:secretsmanager:us-west-2:294535624312:secret:github-aws-sdk-osds-automation-ZHNalp
32+
- name: Checkout
33+
uses: actions/checkout@v3
34+
with:
35+
fetch-depth: 0
36+
ref: ${{ github.ref_name }}
37+
token: ${{ env.OSDS_ACCESS_TOKEN }}
38+
- name: Package
39+
run: |
40+
npm ci
41+
npm test
42+
npm run package
43+
- name: Commit
44+
run: |
45+
echo "::add-mask::${{ env.OSDS_ACCESS_TOKEN }}}"
46+
git config --global user.name "GitHub Actions"
47+
git add dist/
48+
git commit -m "chore: Update dist" || echo "No changes to commit"
49+
git push https://${{ env.OSDS_ACCESS_TOKEN }}@github.com/aws-actions/configure-aws-credentials.git

0 commit comments

Comments
 (0)