Skip to content

Commit 38cda03

Browse files
committed
build: release workflow
1 parent 7f71485 commit 38cda03

File tree

6 files changed

+91
-38
lines changed

6 files changed

+91
-38
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish Package to npmjs
2+
3+
runs:
4+
using: "composite"
5+
steps:
6+
- uses: actions/checkout@v4
7+
8+
- name: Use Node.js 18.x
9+
uses: actions/setup-node@v4
10+
with:
11+
node-version: '18.x'
12+
registry-url: 'https://registry.npmjs.org'
13+
14+
- name: Cache dependencies
15+
uses: actions/cache@v4
16+
with:
17+
path: |
18+
node_modules
19+
*/*/node_modules
20+
key: yarn-deps-${{ hashFiles('**/yarn.lock') }}
21+
22+
- name: Install dependencies
23+
shell: bash
24+
run: yarn
25+
26+
- name: Transpile to JavaScript
27+
shell: bash
28+
run: yarn transpile
29+
30+
- run: npm publish --access=public
31+
shell: bash
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/npm-publish.yml

-37
This file was deleted.

.github/workflows/publish-npm.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: publish npm
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
uses: ./.github/workflows/actions/npm-publish@main
10+
secrets: inherit

.github/workflows/release.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'SemVer that will be used for publishing (e.g. "0.0.1")'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
prepare-release:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Prepare ${{ inputs.version }} release
19+
run: |
20+
git config user.name "think-it-account"
21+
git config user.email "[email protected]"
22+
23+
sed -i 's/"version":.*/"version": "${{ inputs.version }}",/g' package.json
24+
git add .
25+
git commit -m "Prepare release ${{ inputs.version }}"
26+
git push origin main
27+
28+
git tag --force v${{ inputs.version }}
29+
git push --force origin v${{ inputs.version }}
30+
31+
- name: Create GitHub Release
32+
uses: ncipollo/release-action@v1
33+
with:
34+
generateReleaseNotes: true
35+
tag: ${{ inputs.version }}
36+
token: ${{ secrets.GITHUB_TOKEN }}
37+
makeLatest: true
38+
removeArtifacts: true
39+
40+
publish:
41+
needs: prepare-release
42+
runs-on: ubuntu-latest
43+
uses: ./.github/workflows/actions/npm-publish@main
44+
secrets: inherit

.github/workflows/pull-request-testing.yml .github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pull request testing
1+
name: test
22

33
on:
44
push:

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ connectors with capabilities described in the
168168
Please, adhere to the [CONTRIBUTING](CONTRIBUTING.md) guidelines when suggesting
169169
changes in this repository.
170170

171+
### Release
172+
The `release` github action workflow takes care of release.
173+
171174
## License
172175

173176
Copyright 2022-2023 Think.iT GmbH.

0 commit comments

Comments
 (0)