diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 0182809e..80de99f0 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -3,6 +3,8 @@ name: Publish Package to npmjs on: release: types: [created] + workflow_dispatch: + workflow_call: jobs: build: @@ -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: | @@ -34,4 +36,4 @@ jobs: - run: npm publish --access=public env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..478b3ba2 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 "technical@think-it.io" + + 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 diff --git a/README.md b/README.md index cb62f5da..fb0082fb 100644 --- a/README.md +++ b/README.md @@ -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.