From ba5befe7fec7bcfaff665573c2aa11dc4763a9b9 Mon Sep 17 00:00:00 2001 From: Candy Tsai Date: Fri, 6 Sep 2024 15:59:00 +0800 Subject: [PATCH 1/3] Replace placeholder version with tag-dev-sha for latest trunk releases --- .github/workflows/publish-latest-plugin-zip.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-latest-plugin-zip.yml b/.github/workflows/publish-latest-plugin-zip.yml index 5f1dd84..9a15c6c 100644 --- a/.github/workflows/publish-latest-plugin-zip.yml +++ b/.github/workflows/publish-latest-plugin-zip.yml @@ -1,7 +1,8 @@ name: Publish plugin to Automattic/create-content-model-releases latest on trunk merge on: - push: + pull_request: + types: [opened, synchronize, reopened] branches: - trunk @@ -12,6 +13,14 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get most recent tag + id: get_tag + uses: WyriHaximus/github-action-get-previous-tag@v1 + with: + fallback: 1.0.0 - name: Setup Node.js uses: actions/setup-node@v4 @@ -21,6 +30,9 @@ jobs: - name: Install dependencies run: npm ci + - name: Update version to latest trunk commit + run: "find . -type f -exec sed -i 's/0.0.0-placeholder/${{ steps.get_tag.outputs.tag }}-dev-${{ github.sha }}/g' {} +" + - name: Build and create plugin zip run: npm run plugin-zip @@ -51,4 +63,4 @@ jobs: destination-repository-name: "create-content-model-releases" user-name: ${{ github.actor }} user-email: ${{ steps.get_email.outputs.email }} - target-branch: latest + target-branch: test From b6e14bfefa4d19981827e4a00b0a9904d3ae95f2 Mon Sep 17 00:00:00 2001 From: Candy Tsai Date: Fri, 6 Sep 2024 16:01:48 +0800 Subject: [PATCH 2/3] Move sed command step before dependency install --- .github/workflows/publish-latest-plugin-zip.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-latest-plugin-zip.yml b/.github/workflows/publish-latest-plugin-zip.yml index 9a15c6c..d15e9e7 100644 --- a/.github/workflows/publish-latest-plugin-zip.yml +++ b/.github/workflows/publish-latest-plugin-zip.yml @@ -22,6 +22,9 @@ jobs: with: fallback: 1.0.0 + - name: Update version to latest trunk commit + run: "find . -type f -exec sed -i 's/0.0.0-placeholder/${{ steps.get_tag.outputs.tag }}-dev-${{ github.sha }}/g' {} +" + - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -30,9 +33,6 @@ jobs: - name: Install dependencies run: npm ci - - name: Update version to latest trunk commit - run: "find . -type f -exec sed -i 's/0.0.0-placeholder/${{ steps.get_tag.outputs.tag }}-dev-${{ github.sha }}/g' {} +" - - name: Build and create plugin zip run: npm run plugin-zip From 92ff5b69c7e036d4f5a18efa7efdb354b23a9ca2 Mon Sep 17 00:00:00 2001 From: Candy Tsai Date: Fri, 6 Sep 2024 16:12:52 +0800 Subject: [PATCH 3/3] Remove test code for the PR --- .github/workflows/publish-latest-plugin-zip.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-latest-plugin-zip.yml b/.github/workflows/publish-latest-plugin-zip.yml index d15e9e7..b964d8f 100644 --- a/.github/workflows/publish-latest-plugin-zip.yml +++ b/.github/workflows/publish-latest-plugin-zip.yml @@ -1,8 +1,7 @@ name: Publish plugin to Automattic/create-content-model-releases latest on trunk merge on: - pull_request: - types: [opened, synchronize, reopened] + push: branches: - trunk @@ -63,4 +62,4 @@ jobs: destination-repository-name: "create-content-model-releases" user-name: ${{ github.actor }} user-email: ${{ steps.get_email.outputs.email }} - target-branch: test + target-branch: latest