From 3adb68e301cc9fc3356ace8ca0d048b9fbbdaf2c Mon Sep 17 00:00:00 2001 From: Manuel Ruck Date: Tue, 17 Oct 2023 21:46:27 +0200 Subject: [PATCH] =?UTF-8?q?ci:=20=F0=9F=91=B7=20fix=20release=20creating?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Ruck --- .github/workflows/release.yaml | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4f29523f9..253a77d5d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -22,6 +22,9 @@ on: # - 'minor' # - 'patch' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + jobs: analyse-changed-packages: runs-on: ubuntu-latest @@ -67,9 +70,13 @@ jobs: - name: Checkout Repo uses: actions/checkout@v4 with: + ref: fetch-depth: 0 token: ${{ secrets.PAT }} # use PAT to being able to push to protected branch later on + - run: git checkout ${{ github.event.repository.default_branch }} + if: ${{ contains(github.ref, github.event.repository.default_branch) }} + - uses: pnpm/action-setup@v2 with: version: 8 @@ -127,10 +134,16 @@ jobs: echo "$changelog" echo "{${{ matrix.package }} v$changelog}" >> $GITHUB_STEP_SUMMARY - changelog="${changelog//'%'/'%25'}" - changelog="${changelog//$'\n'/'%0A'}" - changelog="${changelog//$'\r'/'%0D'}" - echo "changelog=$changelog" >> $GITHUB_OUTPUT + + { + echo 'CHANGELOG<> "$GITHUB_ENV" + + echo 'CHANGELOG<> $GITHUB_ENV + echo $changelog >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV working-directory: ${{ steps.get-directory.outputs.directory }} env: @@ -138,10 +151,11 @@ jobs: - name: Determine next version number if: inputs.releaseVersion == 'auto' + id: determine_next_version run: | nextVersion=`pnpm dlx commit-and-tag-version --path . -t $MATRIX_PACKAGE@v --dry-run | sed -n '/^---$/,/^---$/p' | grep -P -o '(\d+\.)(\d+\.)(\d)' | head -n 1` echo "$nextVersion" - echo "NEXT_VERSION=$nextVersion" >> $GITHUB_ENV + echo "NEXT_VERSION=$nextVersion" >> $GITHUB_OUTPUT working-directory: ${{ steps.get-directory.outputs.directory }} env: MATRIX_PACKAGE: ${{ matrix.package }} @@ -192,9 +206,10 @@ jobs: if: inputs.dryRun == false env: GITHUB_TOKEN: ${{ secrets.PAT }} # # use PAT to being able to push to protected branch later on + CHANGELOG: '${{ env.CHANGELOG }}' with: - tag: $NEXT_VERSION - name: $NEXT_VERSION + tag: ${{ matrix.package }}@v${{ steps.determine_next_version.outputs.NEXT_VERSION }} + name: ${{ matrix.package }}@v${{ steps.determine_next_version.outputs.NEXT_VERSION }} prerelease: true body: | - ${{ steps.get_changelog.outputs.changelog }} + '${{ env.CHANGELOG }}'