From f2d50185b066b9f703d37293f268fa1d7f80079b Mon Sep 17 00:00:00 2001 From: Ilan Uzan Date: Sat, 29 Jun 2024 13:42:13 +0300 Subject: [PATCH] [release] split release --- .github/workflows/{main.yml => ci.yml} | 86 +++++-------------------- .github/workflows/docs.yml | 1 - .github/workflows/release.yml | 87 ++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 72 deletions(-) rename .github/workflows/{main.yml => ci.yml} (69%) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/main.yml b/.github/workflows/ci.yml similarity index 69% rename from .github/workflows/main.yml rename to .github/workflows/ci.yml index d487d40..00903e3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Main +name: CI defaults: run: shell: bash @@ -121,18 +121,16 @@ jobs: - name: End-to-End Tests run: ./scripts/tests/run_end2end.sh - - release: - name: Release + + + release-tag: + name: Release Tag runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[release]') - needs: [build, end2end-tests] + #if: contains(github.event.head_commit.message, '[release]') + needs: [ build, end2end-tests ] + steps: - - name: Check out Git repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - + - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: name: wasm-file @@ -143,14 +141,14 @@ jobs: bump_version() { latest_tag=$1 latest_commit_msg=$2 - + BUMP_TYPE="patch" # Initialize the default version bump type to patch if [[ $latest_commit_msg == *"[major]"* ]]; then BUMP_TYPE="major" elif [[ $latest_commit_msg == *"[minor]"* ]]; then BUMP_TYPE="minor" fi - + case $BUMP_TYPE in "major") NEW_TAG=$(echo $latest_tag | awk -F. '{OFS="."; $1="v" substr($1,2)+1; $2="0"; $3="0"; print}') @@ -164,13 +162,13 @@ jobs: esac return NEW_TAG } - + set -e - + echo "Extract the latest tag version" LATEST_TAG_COMMIT=$(git rev-list --tags --max-count=1) LATEST_COMMIT_MSG=$(git log -1 --pretty=%B) - + if [ -z $LATEST_TAG_COMMIT ]; then NEW_TAG="0.10.0" # default 1st release version else @@ -184,58 +182,4 @@ jobs: # Create a new tag git tag $NEW_TAG - git push origin $NEW_TAG - - - name: Calculate sha256 - run: | - SHA256_HASH=$(sha256sum plugin.wasm | awk '{ print $1 }') - echo "SHA256_HASH=$SHA256_HASH" >> $GITHUB_ENV - echo "The calculated sha256 is $SHA256_HASH" - - - name: Create release draft - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - set -e - - LATEST_TAG=${{ env.LATEST_TAG }} - NEW_TAG=${{ env.NEW_TAG }} - SHA256_HASH=${{ env.SHA256_HASH }} - - if [ -z $LATEST_TAG ]; then - CHANGE_LOG="TBD: Manually fill the 1st release features in here" - else - PREVIOUS_TAG=$(git rev-list -n 1 $LATEST_TAG) - CHANGE_LOG=$(git --no-pager log $PREVIOUS_TAG..HEAD --pretty=format:'%h - %an, %ar : %s') - fi - - # Define the release notes template - RELEASE_NOTES=$(cat <> $GITHUB_ENV + echo "The calculated sha256 is $SHA256_HASH" + + - name: Create release draft + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -e + + LATEST_TAG=${{ env.LATEST_TAG }} + NEW_TAG=${{ env.NEW_TAG }} + SHA256_HASH=${{ env.SHA256_HASH }} + + if [ -z $LATEST_TAG ]; then + CHANGE_LOG="TBD: Manually fill the 1st release features in here" + else + PREVIOUS_TAG=$(git rev-list -n 1 $LATEST_TAG) + CHANGE_LOG=$(git --no-pager log $PREVIOUS_TAG..HEAD --pretty=format:'%h - %an, %ar : %s') + fi + + # Define the release notes template + RELEASE_NOTES=$(cat <