Skip to content

Commit

Permalink
build: release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt committed May 6, 2024
1 parent 7f71485 commit 9f23c4b
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 38 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/actions/npm-publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish Package to npmjs

runs:
using: "composite"
steps:
- uses: actions/checkout@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
node_modules
*/*/node_modules
key: yarn-deps-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
shell: bash
run: yarn

- name: Transpile to JavaScript
shell: bash
run: yarn transpile

- run: npm publish --access=public
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37 changes: 0 additions & 37 deletions .github/workflows/npm-publish.yml

This file was deleted.

10 changes: 10 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: publish npm

on:
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
uses: ./.github/workflows/actions/npm-publish
secrets: inherit
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: release

on:
workflow_dispatch:
inputs:
version:
description: 'SemVer that will be used for publishing (e.g. "0.0.1")'
required: true
type: string

jobs:
prepare-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Prepare ${{ inputs.version }} release
run: |
git config user.name "think-it-account"
git config user.email "technical@think-it.io"
sed -i 's/"version":.*/"version": "${{ inputs.version }}",/g' package.json
git add .
git commit -m "Prepare release ${{ inputs.version }}"
git push origin main
git tag --force v${{ inputs.version }}
git push --force origin v${{ inputs.version }}
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
tag: ${{ inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
makeLatest: true
removeArtifacts: true

publish:
needs: prepare-release
runs-on: ubuntu-latest
uses: ./.github/workflows/actions/npm-publish
secrets: inherit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pull request testing
name: test

on:
push:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ connectors with capabilities described in the
Please, adhere to the [CONTRIBUTING](CONTRIBUTING.md) guidelines when suggesting
changes in this repository.

### Release
The `release` github action workflow takes care of release.

## License

Copyright 2022-2023 Think.iT GmbH.
Expand Down

0 comments on commit 9f23c4b

Please sign in to comment.