From 1f727120cfe114128f47e32b9a1343c53dbbb5f0 Mon Sep 17 00:00:00 2001 From: drptbl Date: Sat, 16 Nov 2024 22:26:36 +0000 Subject: [PATCH] ci: use release tags Signed-off-by: drptbl --- .github/workflows/sync-and-build.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sync-and-build.yml b/.github/workflows/sync-and-build.yml index fd9a8e143034..46799e113bb0 100644 --- a/.github/workflows/sync-and-build.yml +++ b/.github/workflows/sync-and-build.yml @@ -33,11 +33,19 @@ jobs: - name: Sync with upstream env: PAT_TOKEN: ${{ secrets.PAT_TOKEN }} + RELEASE_TAG: ${{ github.event.client_payload.release }} run: | git checkout develop - git merge upstream/develop - git push origin develop + git fetch upstream --tags # Fetch all tags + # If triggered by monitor, checkout the specific release tag + if [ -n "$RELEASE_TAG" ]; then + git checkout $RELEASE_TAG + else + git merge upstream/develop + fi + + git push origin develop - name: Setup Node.js uses: actions/setup-node@v4 @@ -69,8 +77,14 @@ jobs: - name: Create Release env: GH_TOKEN: ${{ secrets.PAT_TOKEN }} + RELEASE_TAG: ${{ github.event.client_payload.release }} run: | - VERSION=$(node -p "require('./package.json').version") + # Use the tag version if provided, otherwise use package.json + if [ -n "$RELEASE_TAG" ]; then + VERSION=${RELEASE_TAG#v} # Remove 'v' prefix if present + else + VERSION=$(node -p "require('./package.json').version") + fi # Check if release already exists if gh release view "v${VERSION}-no-lavamoat" --repo ${{ github.repository }} &>/dev/null; then @@ -78,7 +92,7 @@ jobs: exit 0 fi - # Create the release if it doesn't exist + # Create the release gh release create "v${VERSION}-no-lavamoat" \ --repo ${{ github.repository }} \ --title "v${VERSION} (No LavaMoat)" \