From 073e6cb07907f6d191255783239f07909616e723 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Mon, 29 Jan 2024 12:42:58 +0100 Subject: [PATCH 1/2] Added tag and release action Signed-off-by: Andrea Cosentino --- .github/workflows/tag-and-release.yml | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/tag-and-release.yml diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml new file mode 100644 index 000000000..132096b4c --- /dev/null +++ b/.github/workflows/tag-and-release.yml @@ -0,0 +1,30 @@ +name: Create Kaoto-next tag and release +on: + workflow_dispatch: + inputs: + tag_version: + type: The tag to release + description: The tag version we want to release + required: true + +jobs: + build: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Bump version and push tag + id: tag_version + uses: mathieudutour/github-tag-action@v6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + custom_tag: ${{ github.event.inputs.tag_version }} + create_annotated_tag: true + tag_prefix: "" + - name: Create a GitHub release + uses: ncipollo/release-action@v1 + with: + tag: ${{ steps.tag_version.outputs.new_tag }} + name: Release ${{ steps.tag_version.outputs.new_tag }} + body: ${{ steps.tag_version.outputs.changelog }} From 2b8ecfae2b297a029fd1f17a2dba6736cd686a12 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Mon, 29 Jan 2024 13:23:18 +0100 Subject: [PATCH 2/2] Include also NPM Package Publish process in a single action with tag and release Signed-off-by: Andrea Cosentino --- .github/workflows/create-pre-release-pr.yml | 73 --------------------- .github/workflows/publish-npm-package.yml | 41 ------------ .github/workflows/release-pipeline.yml | 58 ++++++++++++++++ .github/workflows/tag-and-release.yml | 30 --------- 4 files changed, 58 insertions(+), 144 deletions(-) delete mode 100644 .github/workflows/create-pre-release-pr.yml delete mode 100644 .github/workflows/publish-npm-package.yml create mode 100644 .github/workflows/release-pipeline.yml delete mode 100644 .github/workflows/tag-and-release.yml diff --git a/.github/workflows/create-pre-release-pr.yml b/.github/workflows/create-pre-release-pr.yml deleted file mode 100644 index 69f7338bf..000000000 --- a/.github/workflows/create-pre-release-pr.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: โ†—๏ธ Create a Pull request for a new release -# Event for the workflow -on: - workflow_dispatch: - -# Allow one concurrent deployment -concurrency: - group: "publish" - cancel-in-progress: true - - -jobs: - create-pre-release-pr: - permissions: - contents: write - pull-requests: write - - runs-on: ubuntu-latest - steps: - - name: 'Checkout source code' - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Checkout all branches and tags - token: ${{ secrets.GITHUB_TOKEN }} - fetch-tags: true - - - uses: actions/setup-node@v4 - with: - node-version: '20.x' - registry-url: 'https://registry.npmjs.org' - scope: '@kaoto-next' - cache: 'yarn' - - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '21' - - - name: ๐Ÿ”ง Install dependencies - run: yarn - - - name: ๐Ÿงช Run tests - run: yarn workspaces foreach --verbose --topological-dev run test - - # Build lib - - name: Build @kaoto-next/ui package in lib mode - run: yarn workspace @kaoto-next/ui run build:lib - - - name: Git user config - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - - name: Version - run: yarn version - - - name: Get version - id: get_version - run: | - echo "TITLE=$(git --no-pager log --format=%s -n 1)" >> $GITHUB_OUTPUT - # echo "BODY='$(git --no-pager log --format=%B -n 1)'" >> $GITHUB_OUTPUT - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v5 - with: - commit-message: "chore: release" - title: ${{ steps.get_version.outputs.TITLE }} - body: ${{ steps.get_version.outputs.BODY }} - branch: chore/pre-release - base: main - token: ${{ secrets.GITHUB_TOKEN }} - delete-branch: true - labels: release diff --git a/.github/workflows/publish-npm-package.yml b/.github/workflows/publish-npm-package.yml deleted file mode 100644 index 2f292f50b..000000000 --- a/.github/workflows/publish-npm-package.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: ๐Ÿท๏ธ Publish a new version of the package -on: - # We publish a new version when a release is created - release: - types: [published] - -jobs: - release-and-publish: - permissions: - contents: write - - runs-on: ubuntu-latest - steps: - - name: 'Checkout source code' - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version: '20.x' - registry-url: 'https://registry.npmjs.org' - scope: '@kaoto-next' - cache: 'yarn' - - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '21' - - - name: ๐Ÿ”ง Install dependencies - run: yarn - - # Build lib - - name: Build @kaoto-next/ui package in lib mode - run: yarn workspace @kaoto-next/ui run build:lib - - # Version and publish - - name: 'Version and publish' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NODE_AUTH_TOKEN: ${{ secrets.KAOTO_NEXT_NPM_TOKEN }} - run: yarn publish diff --git a/.github/workflows/release-pipeline.yml b/.github/workflows/release-pipeline.yml new file mode 100644 index 000000000..60b5f49d0 --- /dev/null +++ b/.github/workflows/release-pipeline.yml @@ -0,0 +1,58 @@ +name: Release Pipeline, create a tag/release for Kaoto Next and invoke publish NPM Package +on: + workflow_dispatch: + inputs: + tag_version: + type: The tag to release + description: The tag version we want to release + required: true + +jobs: + build: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Bump version and push tag + id: tag_version + uses: mathieudutour/github-tag-action@v6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + custom_tag: ${{ github.event.inputs.tag_version }} + create_annotated_tag: true + tag_prefix: "" + + - name: Create a GitHub release + uses: ncipollo/release-action@v1 + with: + tag: ${{ steps.tag_version.outputs.new_tag }} + name: Release ${{ steps.tag_version.outputs.new_tag }} + body: ${{ steps.tag_version.outputs.changelog }} + + - uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + scope: '@kaoto-next' + cache: 'yarn' + + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + + - name: ๐Ÿ”ง Install dependencies + run: yarn + + # Build lib + - name: Build @kaoto-next/ui package in lib mode + run: yarn workspace @kaoto-next/ui run build:lib + + # Version and publish + - name: 'Version and publish' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.KAOTO_NEXT_NPM_TOKEN }} + run: yarn publish diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml deleted file mode 100644 index 132096b4c..000000000 --- a/.github/workflows/tag-and-release.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Create Kaoto-next tag and release -on: - workflow_dispatch: - inputs: - tag_version: - type: The tag to release - description: The tag version we want to release - required: true - -jobs: - build: - permissions: - contents: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Bump version and push tag - id: tag_version - uses: mathieudutour/github-tag-action@v6.1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - custom_tag: ${{ github.event.inputs.tag_version }} - create_annotated_tag: true - tag_prefix: "" - - name: Create a GitHub release - uses: ncipollo/release-action@v1 - with: - tag: ${{ steps.tag_version.outputs.new_tag }} - name: Release ${{ steps.tag_version.outputs.new_tag }} - body: ${{ steps.tag_version.outputs.changelog }}