Skip to content

Commit e8b3b4e

Browse files
fix(ci): semantic-release
1 parent b2ba23a commit e8b3b4e

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

.github/workflows/main.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: CI
22
permissions:
33
contents: read
4-
issues: write
54

65
on:
76
push:
@@ -23,6 +22,8 @@ jobs:
2322
id-token: write
2423
actions: read
2524
uses: ./.github/workflows/release.yaml
25+
secrets:
26+
VAULT_URL: ${{ secrets.VAULT_URL }}
2627

2728
notify-failure:
2829
if: |

.github/workflows/release.yaml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: release
22

33
on:
44
workflow_call:
5+
secrets:
6+
VAULT_URL:
7+
required: true
58

69
jobs:
710
release:
@@ -11,6 +14,29 @@ jobs:
1114
id-token: write # Required for OIDC trusted publishing
1215
runs-on: ubuntu-latest
1316
steps:
17+
- name: 'Retrieve Secrets from Vault'
18+
id: vault
19+
uses: hashicorp/vault-action@v3.4.0
20+
with:
21+
url: ${{ secrets.VAULT_URL }}
22+
role: ${{ github.event.repository.name }}-github-action
23+
method: jwt
24+
path: github-actions
25+
exportEnv: false
26+
secrets: |
27+
github/token/${{ github.event.repository.name }}-semantic-release token | GITHUB_TOKEN ;
28+
29+
- name: Get Automation Bot User ID
30+
id: get-user-id
31+
run: echo "user-id=$(gh api "/users/contentful-automation[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
32+
env:
33+
GITHUB_TOKEN: ${{ steps.vault.outputs.GITHUB_TOKEN }}
34+
35+
- name: Setting up Git User Credentials
36+
run: |
37+
git config --global user.name 'contentful-automation[bot]'
38+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+contentful-automation[bot]@users.noreply.github.com'
39+
1440
- name: Checkout code
1541
uses: actions/checkout@v5
1642
with:
@@ -29,17 +55,11 @@ jobs:
2955
- name: Install dependencies
3056
run: npm ci
3157

32-
- name: Restore the build folders
33-
uses: actions/cache/restore@v4
34-
with:
35-
path: |
36-
dist
37-
key: build-cache-${{ github.run_id }}-${{ github.run_attempt }}
38-
39-
- name: Setup Chrome
40-
uses: browser-actions/setup-chrome@v2
41-
with:
42-
install-chromedriver: true
58+
- name: Ensure on latest commit
59+
run: |
60+
git fetch origin
61+
git checkout master
62+
git pull origin master
4363
4464
- name: Run semantic release
4565
run: npm run semantic-release

0 commit comments

Comments
 (0)