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 577a0fe
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Publish Package to npmjs
on:
release:
types: [created]
workflow_dispatch:
workflow_call:

jobs:
build:
Expand All @@ -17,7 +19,7 @@ jobs:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'

- name: Cache dependencies
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
Expand All @@ -34,4 +36,4 @@ jobs:

- run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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: Create release/${{ github.event.inputs.version }} branch
run: |
git config user.name "think-it-account"
git config user.email "[email protected]"
git checkout -b release/${{ inputs.version }}
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

- name: Publish package
uses: ./.github/workflows/npm-publish.yml
secrets: inherit
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 577a0fe

Please sign in to comment.