From ba5befe7fec7bcfaff665573c2aa11dc4763a9b9 Mon Sep 17 00:00:00 2001 From: Candy Tsai Date: Fri, 6 Sep 2024 15:59:00 +0800 Subject: [PATCH] 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