Skip to content

Commit 253a27c

Browse files
Ruben van LeeuwenDutchBen
authored andcommitted
Readds github workflow files
1 parent 91aa55c commit 253a27c

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish to NPM
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- 'main'
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
id-token: write
15+
contents: write
16+
steps:
17+
- name: Create GitHub app token
18+
uses: actions/create-github-app-token@v1
19+
id: app-token
20+
with:
21+
app-id: ${{ vars.RW_REPOSITORY_CONTENT_APP_ID }}
22+
private-key: ${{ secrets.RW_REPOSITORY_CONTENT_PRIVATE_KEY }}
23+
owner: ${{ github.repository_owner }}
24+
repositories: 'orchestrator-ui-library'
25+
- uses: actions/checkout@v3
26+
- name: Use Node.js ${{ matrix.node-version }}
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: ${{ matrix.node-version }}
30+
cache: 'npm'
31+
- uses: actions/cache@v3
32+
with:
33+
path: '**/node_modules'
34+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
35+
- name: Create .npmrc file with the NPM token
36+
run: |
37+
cat << EOF > "$HOME/.npmrc"
38+
//registry.npmjs.org/:_authToken=$NPM_TOKEN
39+
EOF
40+
env:
41+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
- name: Installing dependencies
43+
run: npm ci
44+
- name: Create Release Pull Request or Publish
45+
id: changesets
46+
uses: changesets/action@v1
47+
with:
48+
publish: npm run packages:publish
49+
env:
50+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
51+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#
2+
# Use the GitHub API to tag the main branch of another repository.
3+
#
4+
name: Tag example-orchestrator-ui
5+
6+
on:
7+
push:
8+
tags:
9+
- '@orchestrator-ui/orchestrator-ui-components@[0-9]+.[0-9]+.[0-9]+'
10+
release:
11+
types:
12+
- published
13+
tags:
14+
- '@orchestrator-ui/orchestrator-ui-components@[0-9]+.[0-9]+.[0-9]+'
15+
16+
# The main branch of the following repository will be tagged
17+
# with the version part (e.g. 0.3.1) of the tag trigger above.
18+
env:
19+
REPO: 'example-orchestrator-ui'
20+
21+
jobs:
22+
docker:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
steps:
28+
- name: Create GitHub app token
29+
uses: actions/create-github-app-token@v1
30+
id: app-token
31+
with:
32+
app-id: ${{ vars.RW_REPOSITORY_CONTENT_APP_ID }}
33+
private-key: ${{ secrets.RW_REPOSITORY_CONTENT_PRIVATE_KEY }}
34+
owner: ${{ github.repository_owner }}
35+
repositories: ${{ env.REPO }}
36+
- name: Get latest commit SHA
37+
id: sha
38+
uses: actions/github-script@v7
39+
with:
40+
result-encoding: string
41+
script: |
42+
const commit = await github.rest.repos.getCommit({
43+
owner: github.repository_owner,
44+
repo: env.REPO,
45+
ref: 'heads/main',
46+
})
47+
return commit.data.sha
48+
- name: Extract REF from ref_name
49+
run: |
50+
REF_NAME=${{ github.ref_name }}
51+
REF=${REF_NAME/@orchestrator-ui\/orchestrator-ui-components@/}
52+
echo REF=${REF} >> $GITHUB_ENV
53+
- name: Add tag to repository
54+
uses: actions/github-script@v7
55+
env:
56+
REF: ${{ format('refs/tags/{0}', env.REF) }}
57+
SHA: ${{ steps.sha.outputs.result }}
58+
with:
59+
github-token: ${{ steps.app-token.outputs.token }}
60+
script: |
61+
await github.rest.git.createRef({
62+
owner: github.repository_owner,
63+
repo: env.REPO,
64+
ref: process.env.REF,
65+
sha: process.env.SHA,
66+
})

0 commit comments

Comments
 (0)