From 10f57716092e90b0f785189f9e51cf3036259548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane?= Date: Thu, 13 Jul 2023 11:26:39 +0200 Subject: [PATCH] chore: update github worflows --- .github/workflows/merge-develop-in-main.yml | 22 --------------------- .github/workflows/release.yml | 14 ++++++++++--- package.json | 3 ++- scripts/release.sh | 17 ++++++++++++++++ 4 files changed, 30 insertions(+), 26 deletions(-) delete mode 100644 .github/workflows/merge-develop-in-main.yml create mode 100644 scripts/release.sh diff --git a/.github/workflows/merge-develop-in-main.yml b/.github/workflows/merge-develop-in-main.yml deleted file mode 100644 index 053ae31..0000000 --- a/.github/workflows/merge-develop-in-main.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Create Release - -on: - push: - tags: - - "v*" - -jobs: - build: - name: Create Release - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Merge develop in main - uses: devmasx/merge-branch@master - with: - type: now - from_branch: develop - target_branch: main - github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df8fa6e..9d622c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,8 +2,8 @@ name: Create Release on: push: - branches: - - main + tags: + - "v*" jobs: build: @@ -33,6 +33,14 @@ jobs: - name: Commit CHANGELOG.md uses: stefanzweifel/git-auto-commit-action@v4 with: - branch: main + branch: develop commit_message: "docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]" file_pattern: CHANGELOG.md + + - name: Merge develop in main + uses: devmasx/merge-branch@master + with: + type: now + from_branch: develop + target_branch: main + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index f660ca7..0f0be21 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,8 @@ }, "scripts": { "start": "react-scripts start", - "build": "react-scripts build" + "build": "react-scripts build", + "release": "./scripts/release.sh" }, "eslintConfig": { "extends": [ diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100644 index 0000000..e39d626 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,17 @@ +#!/bin/sh +set -e + +# Get package.json version +PACKAGE_VERSION=$(node -p -e "require('./package.json').version") + +# Commit files +git add . +git commit -m "chore: release v$PACKAGE_VERSION" + +# Create new git tag +git tag "v$PACKAGE_VERSION" +git tag -l + +# Push to GitHub +git push origin develop +git push origin "v$PACKAGE_VERSION" \ No newline at end of file