From fad99102c7d5302547d60276d326f777cf5850c2 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 10:24:54 -0500 Subject: [PATCH 01/35] Test publish step --- .github/workflows/repo.yml | 39 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index a44f52ad..da1d3476 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -1,6 +1,9 @@ name: Build & Test -on: push +on: + push: + pull_request: + types: [opened, synchronize] env: NODE_VERSION: 18.x @@ -72,4 +75,36 @@ jobs: - name: Test uses: borales/actions-yarn@v4 with: - cmd: test \ No newline at end of file + cmd: test + + publish: + if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'npm' + + - name: Restore node modules from cache + uses: actions/cache@v3 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Prepare version for publish + id: prep + run: | + PR_NUMBER=$(echo ${{ github.event.number }}) + CURRENT_VERSION=$(node -p "require('./package.json').version") + NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.0" + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV + + - name: Echo version for testing + run: | + echo "Version to publish: $NEW_VERSION" \ No newline at end of file From 25514bf52ed128c24a292298fdc2c6054b5966e7 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 10:46:54 -0500 Subject: [PATCH 02/35] test increment --- .github/workflows/repo.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index da1d3476..3dbe343b 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -107,4 +107,5 @@ jobs: - name: Echo version for testing run: | - echo "Version to publish: $NEW_VERSION" \ No newline at end of file + echo "Version to publish: $NEW_VERSION" + echo "Adds a commit to test increment" \ No newline at end of file From 502bfc7d628922ef366c95cead39b0fcaa44a058 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 10:58:26 -0500 Subject: [PATCH 03/35] increment commit --- .github/workflows/repo.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 3dbe343b..6da7ace2 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -102,7 +102,11 @@ jobs: run: | PR_NUMBER=$(echo ${{ github.event.number }}) CURRENT_VERSION=$(node -p "require('./package.json').version") - NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.0" + # Fetch all history for all tags and branches to ensure we're counting accurately + git fetch --prune --unshallow + # Count the number of commits on the current branch and subtract 1 to start the index at 0 + COMMIT_COUNT=$(($(git rev-list --count HEAD) - 1)) + NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_COUNT}" echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - name: Echo version for testing From 0fe03679b6b868f2d3c9c8e2374906de2bea773c Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 11:02:03 -0500 Subject: [PATCH 04/35] removes on push and fixing commit index --- .github/workflows/repo.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 6da7ace2..d9991c4f 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -1,7 +1,7 @@ name: Build & Test on: - push: + # push: pull_request: types: [opened, synchronize] @@ -102,11 +102,15 @@ jobs: run: | PR_NUMBER=$(echo ${{ github.event.number }}) CURRENT_VERSION=$(node -p "require('./package.json').version") - # Fetch all history for all tags and branches to ensure we're counting accurately - git fetch --prune --unshallow - # Count the number of commits on the current branch and subtract 1 to start the index at 0 - COMMIT_COUNT=$(($(git rev-list --count HEAD) - 1)) - NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_COUNT}" + # Fetch all history for the main branch (or your base branch) + git fetch --depth=1 origin +refs/heads/main:refs/remotes/origin/main + # Find the common ancestor of HEAD and the main branch + COMMON_ANCESTOR=$(git merge-base HEAD origin/main) + # Count the number of commits on the current branch since it diverged from main + COMMIT_INDEX=$(git rev-list --count $COMMON_ANCESTOR..HEAD) + # Since we want the first commit to be 0, subtract 1 to get the index + COMMIT_INDEX=$((COMMIT_INDEX - 1)) + NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_INDEX}" echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - name: Echo version for testing From b5a8113a04677f2a6b6e712f1c67f2d12d8d8ce9 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 11:13:47 -0500 Subject: [PATCH 05/35] Get commit count --- .github/workflows/repo.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index d9991c4f..8a37a8e0 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -102,15 +102,11 @@ jobs: run: | PR_NUMBER=$(echo ${{ github.event.number }}) CURRENT_VERSION=$(node -p "require('./package.json').version") - # Fetch all history for the main branch (or your base branch) - git fetch --depth=1 origin +refs/heads/main:refs/remotes/origin/main - # Find the common ancestor of HEAD and the main branch - COMMON_ANCESTOR=$(git merge-base HEAD origin/main) - # Count the number of commits on the current branch since it diverged from main - COMMIT_INDEX=$(git rev-list --count $COMMON_ANCESTOR..HEAD) - # Since we want the first commit to be 0, subtract 1 to get the index - COMMIT_INDEX=$((COMMIT_INDEX - 1)) - NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_INDEX}" + # Fetch all history for all tags and branches to ensure we're counting accurately + git fetch --prune --unshallow + # Count the number of commits on the current branch and subtract 1 to start the index at 0 + COMMIT_COUNT=$(($(git log master..HEAD --oneline | wc -l) - 1)) + NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_COUNT}" echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - name: Echo version for testing From ad213de343b274b4ca327b593edca2faff4e6495 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 11:29:34 -0500 Subject: [PATCH 06/35] test --- .github/workflows/repo.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 8a37a8e0..0ef92ab8 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -78,17 +78,19 @@ jobs: cmd: test publish: - if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') }} + if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Fetch all history for all branches and tags + - name: Set up Node.js ${{ env.NODE_VERSION }} uses: actions/setup-node@v3 with: node-version: ${{ env.NODE_VERSION }} cache: 'npm' - + - name: Restore node modules from cache uses: actions/cache@v3 with: @@ -96,20 +98,18 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-node- - + - name: Prepare version for publish - id: prep run: | PR_NUMBER=$(echo ${{ github.event.number }}) CURRENT_VERSION=$(node -p "require('./package.json').version") - # Fetch all history for all tags and branches to ensure we're counting accurately - git fetch --prune --unshallow - # Count the number of commits on the current branch and subtract 1 to start the index at 0 + # Ensure we have the full history to accurately count commits + git fetch --prune --unshallow || git fetch --depth=1 origin master:refs/remotes/origin/master + # Count the number of commits on the current branch COMMIT_COUNT=$(($(git log master..HEAD --oneline | wc -l) - 1)) NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_COUNT}" echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - + - name: Echo version for testing run: | - echo "Version to publish: $NEW_VERSION" - echo "Adds a commit to test increment" \ No newline at end of file + echo "Version to publish: $NEW_VERSION" \ No newline at end of file From f7d5eed9228d3756f450dc92b8731dc846dbfc85 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 11:32:13 -0500 Subject: [PATCH 07/35] test --- .github/workflows/repo.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 0ef92ab8..8ffee670 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -103,10 +103,19 @@ jobs: run: | PR_NUMBER=$(echo ${{ github.event.number }}) CURRENT_VERSION=$(node -p "require('./package.json').version") - # Ensure we have the full history to accurately count commits - git fetch --prune --unshallow || git fetch --depth=1 origin master:refs/remotes/origin/master - # Count the number of commits on the current branch - COMMIT_COUNT=$(($(git log master..HEAD --oneline | wc -l) - 1)) + + # Check if repository is shallow and fetch history if necessary + if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then + git fetch --prune --unshallow + else + echo "Repository is already unshallow." + fi + + # Ensure the master branch is fetched + git fetch --depth=1 origin master:refs/remotes/origin/master + + # Use git log to count commits if git rev-list does not work as expected + COMMIT_COUNT=$(git log master..HEAD --oneline | wc -l) NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_COUNT}" echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV From 6ca8452742c9928aeb35fbee9c08d18c697ac25d Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 11:34:18 -0500 Subject: [PATCH 08/35] test --- .github/workflows/repo.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 8ffee670..cb27855f 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -104,20 +104,22 @@ jobs: PR_NUMBER=$(echo ${{ github.event.number }}) CURRENT_VERSION=$(node -p "require('./package.json').version") - # Check if repository is shallow and fetch history if necessary - if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then - git fetch --prune --unshallow + # Explicitly fetch the master branch with its history + git fetch origin master:refs/remotes/origin/master + + # Verify if master branch was fetched + if git rev-parse --verify origin/master; then + echo "Master branch fetched successfully." + + # Use git log to count commits if git rev-list does not work as expected + COMMIT_COUNT=$(git log origin/master..HEAD --oneline | wc -l) + NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_COUNT}" + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV else - echo "Repository is already unshallow." + echo "Failed to fetch master branch." + # Handle error or fallback scenario fi - - # Ensure the master branch is fetched - git fetch --depth=1 origin master:refs/remotes/origin/master - - # Use git log to count commits if git rev-list does not work as expected - COMMIT_COUNT=$(git log master..HEAD --oneline | wc -l) - NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_COUNT}" - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV + - name: Echo version for testing run: | From 8cb383c9b2c6c12c5f52f9c040133cbc8d387fb2 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 11:42:13 -0500 Subject: [PATCH 09/35] echo branch name --- .github/workflows/repo.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index cb27855f..4ec8f628 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -1,4 +1,4 @@ -name: Build & Test +name: Build / Test / Publish on: # push: @@ -112,15 +112,21 @@ jobs: echo "Master branch fetched successfully." # Use git log to count commits if git rev-list does not work as expected - COMMIT_COUNT=$(git log origin/master..HEAD --oneline | wc -l) + COMMIT_COUNT=$($(git log origin/master..HEAD --oneline | wc -l) - 1) NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_COUNT}" echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV else echo "Failed to fetch master branch." # Handle error or fallback scenario fi - + + - name: Echo version and branch for testing + run: | + echo "Version to publish: $NEW_VERSION" + # Extract the branch name from the GitHub event payload + BRANCH_NAME=$(jq --raw-output .pull_request.head.ref $GITHUB_EVENT_PATH) - name: Echo version for testing run: | + echo "Current branch: $BRANCH_NAME" echo "Version to publish: $NEW_VERSION" \ No newline at end of file From 41dac205be634852477dbe2762b9f597455e024e Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 11:45:04 -0500 Subject: [PATCH 10/35] show current branch --- .github/workflows/repo.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 4ec8f628..5ae99f36 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -112,21 +112,15 @@ jobs: echo "Master branch fetched successfully." # Use git log to count commits if git rev-list does not work as expected - COMMIT_COUNT=$($(git log origin/master..HEAD --oneline | wc -l) - 1) + COMMIT_COUNT=$(git log origin/master..HEAD --oneline | wc -l) NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_COUNT}" echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV else echo "Failed to fetch master branch." # Handle error or fallback scenario - fi - - - name: Echo version and branch for testing - run: | - echo "Version to publish: $NEW_VERSION" - # Extract the branch name from the GitHub event payload - BRANCH_NAME=$(jq --raw-output .pull_request.head.ref $GITHUB_EVENT_PATH) + fi - name: Echo version for testing run: | - echo "Current branch: $BRANCH_NAME" + echo "Current branch: $(git branch --show-current)" echo "Version to publish: $NEW_VERSION" \ No newline at end of file From 335b20ed5a29efcdf968675008938124f42ece5f Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 11:49:35 -0500 Subject: [PATCH 11/35] Get current branch --- .github/workflows/repo.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 5ae99f36..e6a31c5f 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -112,7 +112,7 @@ jobs: echo "Master branch fetched successfully." # Use git log to count commits if git rev-list does not work as expected - COMMIT_COUNT=$(git log origin/master..HEAD --oneline | wc -l) + COMMIT_COUNT=$(($(git log master..HEAD --oneline | wc -l) - 1)) NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_COUNT}" echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV else @@ -122,5 +122,5 @@ jobs: - name: Echo version for testing run: | - echo "Current branch: $(git branch --show-current)" + echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT echo "Version to publish: $NEW_VERSION" \ No newline at end of file From 9739d333a1f7ae2b1223031911eb577b6222b5e9 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 11:54:19 -0500 Subject: [PATCH 12/35] Do commit sha --- .github/workflows/repo.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index e6a31c5f..951e11a4 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -112,6 +112,7 @@ jobs: echo "Master branch fetched successfully." # Use git log to count commits if git rev-list does not work as expected + SHORT_SHA=${GITHUB_SHA::7} COMMIT_COUNT=$(($(git log master..HEAD --oneline | wc -l) - 1)) NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_COUNT}" echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV @@ -122,5 +123,5 @@ jobs: - name: Echo version for testing run: | - echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT + echo "Commit SHA: $SHORT_SHA" echo "Version to publish: $NEW_VERSION" \ No newline at end of file From 45ba41f8e1036814e03fb463ed69444a52ddc27a Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 12:08:50 -0500 Subject: [PATCH 13/35] get commit sha --- .github/workflows/repo.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 951e11a4..25fbfed0 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -113,7 +113,7 @@ jobs: # Use git log to count commits if git rev-list does not work as expected SHORT_SHA=${GITHUB_SHA::7} - COMMIT_COUNT=$(($(git log master..HEAD --oneline | wc -l) - 1)) + COMMIT_COUNT=$(git log master..HEAD --oneline | wc -l) NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_COUNT}" echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV else @@ -121,7 +121,13 @@ jobs: # Handle error or fallback scenario fi + - name: Set outputs + id: vars + run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - name: Check outputs + run: echo ${{ steps.vars.outputs.sha_short }} + - name: Echo version for testing run: | - echo "Commit SHA: $SHORT_SHA" echo "Version to publish: $NEW_VERSION" \ No newline at end of file From b1f9c693bd6833ebd86ef9de91f33c1c391cd8ae Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 12:31:24 -0500 Subject: [PATCH 14/35] Get details --- .github/workflows/repo.yml | 52 +++++++++++++++----------------------- 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 25fbfed0..87aefa62 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -1,7 +1,7 @@ -name: Build / Test / Publish +name: Build & Test on: - # push: + push: pull_request: types: [opened, synchronize] @@ -78,19 +78,17 @@ jobs: cmd: test publish: - if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') + if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # Fetch all history for all branches and tags - + - uses: actions/checkout@v2 + - name: Set up Node.js ${{ env.NODE_VERSION }} uses: actions/setup-node@v3 with: node-version: ${{ env.NODE_VERSION }} cache: 'npm' - + - name: Restore node modules from cache uses: actions/cache@v3 with: @@ -98,29 +96,10 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-node- - - - name: Prepare version for publish - run: | - PR_NUMBER=$(echo ${{ github.event.number }}) - CURRENT_VERSION=$(node -p "require('./package.json').version") - - # Explicitly fetch the master branch with its history - git fetch origin master:refs/remotes/origin/master - - # Verify if master branch was fetched - if git rev-parse --verify origin/master; then - echo "Master branch fetched successfully." - - # Use git log to count commits if git rev-list does not work as expected - SHORT_SHA=${GITHUB_SHA::7} - COMMIT_COUNT=$(git log master..HEAD --oneline | wc -l) - NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_COUNT}" - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - else - echo "Failed to fetch master branch." - # Handle error or fallback scenario - fi - + + - name: Branch name + run: echo running on branch ${GITHUB_REF##*/} + - name: Set outputs id: vars run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT @@ -128,6 +107,15 @@ jobs: - name: Check outputs run: echo ${{ steps.vars.outputs.sha_short }} + - name: Prepare version for publish + id: prep + run: | + PR_NUMBER=$(echo ${{ github.event.number }}) + CURRENT_VERSION=$(node -p "require('./package.json').version") + NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.0" + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV + - name: Echo version for testing run: | - echo "Version to publish: $NEW_VERSION" \ No newline at end of file + echo "Version to publish: $NEW_VERSION" + echo "Adds a commit to test increment" \ No newline at end of file From 2dd1102a413e3d3df5e2c676c21a5429bdde1a91 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 12:36:17 -0500 Subject: [PATCH 15/35] Commit sha --- .github/workflows/repo.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 87aefa62..3977f75a 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -97,15 +97,14 @@ jobs: restore-keys: | ${{ runner.os }}-node- - - name: Branch name - run: echo running on branch ${GITHUB_REF##*/} - - - name: Set outputs + - name: Set short git commit SHA id: vars - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - - name: Check outputs - run: echo ${{ steps.vars.outputs.sha_short }} + run: | + calculatedSha=$(git rev-parse --short ${{ github.sha }}) + echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV + + - name: Confirm git commit SHA output + run: echo ${{ env.COMMIT_SHORT_SHA }} - name: Prepare version for publish id: prep From e7ac001dc194d229fd43a303e9a43b6c11c1d9ad Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 12:39:39 -0500 Subject: [PATCH 16/35] Shas are not mathcing up to what shows locally --- .github/workflows/repo.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 3977f75a..9ebe9da6 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -1,7 +1,6 @@ name: Build & Test on: - push: pull_request: types: [opened, synchronize] @@ -96,15 +95,9 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-node- - - - name: Set short git commit SHA - id: vars - run: | - calculatedSha=$(git rev-parse --short ${{ github.sha }}) - echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV - name: Confirm git commit SHA output - run: echo ${{ env.COMMIT_SHORT_SHA }} + run: echo ${{ github.sha }} - name: Prepare version for publish id: prep From a34b45119a85d1095ec145daa52fa113aca0b03d Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 13:03:00 -0500 Subject: [PATCH 17/35] Trying to get SHA correct --- .github/workflows/repo.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 9ebe9da6..ad012544 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -80,7 +80,6 @@ jobs: if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - name: Set up Node.js ${{ env.NODE_VERSION }} uses: actions/setup-node@v3 From 753492f695439b8fad2d6f4f578827f630907f81 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 13:04:14 -0500 Subject: [PATCH 18/35] checkout v3 --- .github/workflows/repo.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index ad012544..86d5ce4f 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -80,6 +80,8 @@ jobs: if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') }} runs-on: ubuntu-latest steps: + - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} + uses: actions/checkout@v3 - name: Set up Node.js ${{ env.NODE_VERSION }} uses: actions/setup-node@v3 From b84ee54f5b0b205bca7cba412f5f21f98402036f Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 13:05:34 -0500 Subject: [PATCH 19/35] checkout v3 --- .github/workflows/repo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 86d5ce4f..67258dcf 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -98,7 +98,7 @@ jobs: ${{ runner.os }}-node- - name: Confirm git commit SHA output - run: echo ${{ github.sha }} + run: echo ${{ github.event.pull_request.head.sha }} - name: Prepare version for publish id: prep From 65e70113b40cd3ce4d097f921531e0c7fb573343 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 13:09:27 -0500 Subject: [PATCH 20/35] Add short sha to version --- .github/workflows/repo.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 67258dcf..783eb38b 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -104,8 +104,9 @@ jobs: id: prep run: | PR_NUMBER=$(echo ${{ github.event.number }}) + COMMIT_SHORT_SHA=$(${{ github.event.pull_request.head.sha }} | cut -c1-7) CURRENT_VERSION=$(node -p "require('./package.json').version") - NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.0" + NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_SHORT_SHA}" echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - name: Echo version for testing From 2de4375f89e63aa71a1684beb8e99deae0b1a783 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 13:11:21 -0500 Subject: [PATCH 21/35] Fix --- .github/workflows/repo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 783eb38b..b83b497c 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -104,7 +104,7 @@ jobs: id: prep run: | PR_NUMBER=$(echo ${{ github.event.number }}) - COMMIT_SHORT_SHA=$(${{ github.event.pull_request.head.sha }} | cut -c1-7) + COMMIT_SHORT_SHA=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-7) CURRENT_VERSION=$(node -p "require('./package.json').version") NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_SHORT_SHA}" echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV From b3ee51fc472a00eb739d71a211bc38faef6e9b08 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 13:34:26 -0500 Subject: [PATCH 22/35] Dry run to test publish, should fail because no creds --- .github/workflows/repo.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index b83b497c..d8c5df4b 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -1,4 +1,4 @@ -name: Build & Test +name: Build / Test / Publish on: pull_request: @@ -77,6 +77,7 @@ jobs: cmd: test publish: + needs: [setup, test] if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') }} runs-on: ubuntu-latest steps: @@ -96,9 +97,6 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-node- - - - name: Confirm git commit SHA output - run: echo ${{ github.event.pull_request.head.sha }} - name: Prepare version for publish id: prep @@ -112,4 +110,8 @@ jobs: - name: Echo version for testing run: | echo "Version to publish: $NEW_VERSION" - echo "Adds a commit to test increment" \ No newline at end of file + + - name: Publish to npm + run: | + npm version $NEW_VERSION + npm publish --tag dev \ No newline at end of file From 29093bf88cf959fbe91c9c5c41c55016160dcd25 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Tue, 19 Mar 2024 13:57:48 -0500 Subject: [PATCH 23/35] Try settings npm creds --- .github/workflows/repo.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index d8c5df4b..d317a31a 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -80,15 +80,26 @@ jobs: needs: [setup, test] if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') }} runs-on: ubuntu-latest + env: + NPM_USERNAME: + NPM_EMAIL: steps: - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} uses: actions/checkout@v3 + - name: Configure npm with username and password + run: | + echo "_auth = $(echo -n '${{ secrets.NPM_USERNAME }}:${{ secrets.NPM_PASSWORD }}' | base64)" > .npmrc + echo "email = ${{ secrets.NPM_EMAIL }}" >> .npmrc + echo "always-auth = true" >> .npmrc + npm whoami + - name: Set up Node.js ${{ env.NODE_VERSION }} uses: actions/setup-node@v3 with: node-version: ${{ env.NODE_VERSION }} cache: 'npm' + registry-url: 'https://registry.npmjs.org/' - name: Restore node modules from cache uses: actions/cache@v3 From 986b5063d91db2b308eca28751b66219043c7c26 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Wed, 20 Mar 2024 08:59:41 -0500 Subject: [PATCH 24/35] login to npm to publish --- .github/workflows/repo.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index d317a31a..efeb2610 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -80,9 +80,6 @@ jobs: needs: [setup, test] if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') }} runs-on: ubuntu-latest - env: - NPM_USERNAME: - NPM_EMAIL: steps: - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} uses: actions/checkout@v3 @@ -109,6 +106,10 @@ jobs: restore-keys: | ${{ runner.os }}-node- + - name: Add npm token to .npmrc + run: | + echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc + - name: Prepare version for publish id: prep run: | From b30d58d15d15290cc85f37c87ae21813583b0d0e Mon Sep 17 00:00:00 2001 From: ryanformio Date: Wed, 20 Mar 2024 09:10:14 -0500 Subject: [PATCH 25/35] Remove an old step --- .github/workflows/repo.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index efeb2610..97a50fae 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -84,12 +84,9 @@ jobs: - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} uses: actions/checkout@v3 - - name: Configure npm with username and password + - name: Add npm token to .npmrc run: | - echo "_auth = $(echo -n '${{ secrets.NPM_USERNAME }}:${{ secrets.NPM_PASSWORD }}' | base64)" > .npmrc - echo "email = ${{ secrets.NPM_EMAIL }}" >> .npmrc - echo "always-auth = true" >> .npmrc - npm whoami + echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc - name: Set up Node.js ${{ env.NODE_VERSION }} uses: actions/setup-node@v3 @@ -106,10 +103,6 @@ jobs: restore-keys: | ${{ runner.os }}-node- - - name: Add npm token to .npmrc - run: | - echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc - - name: Prepare version for publish id: prep run: | From cd1cc6b4bc8dee7ae1ad5adb4c31e2d819873a26 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Wed, 20 Mar 2024 10:14:34 -0500 Subject: [PATCH 26/35] With ssh key --- .github/workflows/repo.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 97a50fae..8beb45b7 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -84,6 +84,11 @@ jobs: - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} uses: actions/checkout@v3 + - name: Set up SSH key + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_KEY }} + - name: Add npm token to .npmrc run: | echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc From 7e07c26ad2280767beff067486b306722f21e3b1 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Wed, 20 Mar 2024 10:23:50 -0500 Subject: [PATCH 27/35] try configuring pkgbot as user --- .github/workflows/repo.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 8beb45b7..f6ca5ff4 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -84,10 +84,10 @@ jobs: - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} uses: actions/checkout@v3 - - name: Set up SSH key - uses: webfactory/ssh-agent@v0.7.0 - with: - ssh-private-key: ${{ secrets.SSH_KEY }} + - name: Configure Git user + run: | + git config --global user.email "pkgbot@form.io" + git config --global user.name "pkgbot" - name: Add npm token to .npmrc run: | From 836a40618524fdd7174fb13d0e0857804aac47e5 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Thu, 21 Mar 2024 11:25:52 -0500 Subject: [PATCH 28/35] Cache build step for use in publish step --- .github/workflows/repo.yml | 42 ++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index f6ca5ff4..a5c0ed37 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -56,6 +56,14 @@ jobs: with: cmd: build + - name: Cache build directory + uses: actions/cache@v3 + with: + path: . + key: ${{ runner.os }}-build-${{ hashFiles('build.tgz') }} + restore-keys: | + ${{ runner.os }}-build- + test: needs: setup runs-on: ubuntu-latest @@ -100,28 +108,44 @@ jobs: cache: 'npm' registry-url: 'https://registry.npmjs.org/' - - name: Restore node modules from cache + # Restore Build cache + - name: Restore build cache uses: actions/cache@v3 with: - path: node_modules - key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} + path: . + key: ${{ runner.os }}-build-${{ hashFiles('build.tgz') }} restore-keys: | - ${{ runner.os }}-node- + ${{ runner.os }}-build- + + - name: Show workspace contents + run: | + ls -R . - name: Prepare version for publish id: prep run: | + # Extract the pull request number and the short SHA of the commit PR_NUMBER=$(echo ${{ github.event.number }}) COMMIT_SHORT_SHA=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-7) + + # Extract the current version from package.json CURRENT_VERSION=$(node -p "require('./package.json').version") - NEW_VERSION="${CURRENT_VERSION}-dev.${PR_NUMBER}.${COMMIT_SHORT_SHA}" + + # If the current version includes '-rc.', remove it and everything after + # This step ensures that we start with a base version like '3.0.0' even if it was a release candidate + BASE_VERSION=$(echo "$CURRENT_VERSION" | sed 's/-rc.*//') + + # Construct the new version string + NEW_VERSION="${BASE_VERSION}-dev.${PR_NUMBER}.${COMMIT_SHORT_SHA}" + + # Output the new version for use in subsequent GitHub Actions steps echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - name: Echo version for testing run: | echo "Version to publish: $NEW_VERSION" - - name: Publish to npm - run: | - npm version $NEW_VERSION - npm publish --tag dev \ No newline at end of file + # - name: Publish to npm + # run: | + # npm version $NEW_VERSION + # npm publish --tag dev \ No newline at end of file From 7cd9655ffaff837c0e37859dbf3576e8a4a5daec Mon Sep 17 00:00:00 2001 From: ryanformio Date: Thu, 21 Mar 2024 11:28:53 -0500 Subject: [PATCH 29/35] Remove the checkout step --- .github/workflows/repo.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index a5c0ed37..454ffbc8 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -89,9 +89,7 @@ jobs: if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') }} runs-on: ubuntu-latest steps: - - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} - uses: actions/checkout@v3 - + - name: Configure Git user run: | git config --global user.email "pkgbot@form.io" From 3e73af80582b09cfd761a6bc202aa3cbc29228e2 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Thu, 21 Mar 2024 11:33:42 -0500 Subject: [PATCH 30/35] Going to build in the publish step --- .github/workflows/repo.yml | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 454ffbc8..38309b1d 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -56,14 +56,6 @@ jobs: with: cmd: build - - name: Cache build directory - uses: actions/cache@v3 - with: - path: . - key: ${{ runner.os }}-build-${{ hashFiles('build.tgz') }} - restore-keys: | - ${{ runner.os }}-build- - test: needs: setup runs-on: ubuntu-latest @@ -89,7 +81,9 @@ jobs: if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') }} runs-on: ubuntu-latest steps: - + - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} + uses: actions/checkout@v3 + - name: Configure Git user run: | git config --global user.email "pkgbot@form.io" @@ -106,14 +100,18 @@ jobs: cache: 'npm' registry-url: 'https://registry.npmjs.org/' - # Restore Build cache - - name: Restore build cache + - name: Restore node modules from cache uses: actions/cache@v3 with: - path: . - key: ${{ runner.os }}-build-${{ hashFiles('build.tgz') }} + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-build- + ${{ runner.os }}-node- + + - name: Build + uses: borales/actions-yarn@v4 + with: + cmd: build - name: Show workspace contents run: | @@ -143,7 +141,7 @@ jobs: run: | echo "Version to publish: $NEW_VERSION" - # - name: Publish to npm - # run: | - # npm version $NEW_VERSION - # npm publish --tag dev \ No newline at end of file + - name: Publish to npm + run: | + npm version $NEW_VERSION + npm publish --tag dev \ No newline at end of file From b69f5297de9ecd22c3c01af938678a12f26a48f5 Mon Sep 17 00:00:00 2001 From: ryanformio Date: Thu, 21 Mar 2024 13:24:39 -0500 Subject: [PATCH 31/35] 2.0.0-rc.20-dev.60.3e73af8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 53766554..263d8ea2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@formio/core", - "version": "2.0.0-rc.20", + "version": "2.0.0-rc.20-dev.60.3e73af8", "description": "The core Form.io renderering framework.", "main": "lib/index.js", "exports": { From e81e083ba1371883a22dcf9858a45c21758ab84f Mon Sep 17 00:00:00 2001 From: ryanformio Date: Thu, 21 Mar 2024 13:28:36 -0500 Subject: [PATCH 32/35] Remove workspace contents checker, need to update tag=dev --- .github/workflows/repo.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 38309b1d..803b64f3 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -113,10 +113,6 @@ jobs: with: cmd: build - - name: Show workspace contents - run: | - ls -R . - - name: Prepare version for publish id: prep run: | From cf0a822fc6aac9f9969cd0a2869742933754a55a Mon Sep 17 00:00:00 2001 From: ryanformio Date: Thu, 21 Mar 2024 14:40:25 -0500 Subject: [PATCH 33/35] Updated command --- .github/workflows/{repo.yml => ci.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{repo.yml => ci.yml} (97%) diff --git a/.github/workflows/repo.yml b/.github/workflows/ci.yml similarity index 97% rename from .github/workflows/repo.yml rename to .github/workflows/ci.yml index 803b64f3..650eb24d 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Build / Test / Publish +name: Build, Test, Publish on: pull_request: @@ -125,7 +125,7 @@ jobs: # If the current version includes '-rc.', remove it and everything after # This step ensures that we start with a base version like '3.0.0' even if it was a release candidate - BASE_VERSION=$(echo "$CURRENT_VERSION" | sed 's/-rc.*//') + BASE_VERSION=$(echo "$CURRENT_VERSION" | cut -d'-' -f1) # Construct the new version string NEW_VERSION="${BASE_VERSION}-dev.${PR_NUMBER}.${COMMIT_SHORT_SHA}" From b196eba144493f7f1b0819d0053fd155bc4c7a7c Mon Sep 17 00:00:00 2001 From: ryanformio Date: Mon, 25 Mar 2024 10:36:13 -0500 Subject: [PATCH 34/35] Updated to node 20 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 650eb24d..7c7b7938 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: types: [opened, synchronize] env: - NODE_VERSION: 18.x + NODE_VERSION: 20.x jobs: setup: From 8d3c5e6dfcc5dfa0e4fc3160ea820089f868838f Mon Sep 17 00:00:00 2001 From: ryanformio Date: Wed, 3 Apr 2024 14:03:57 -0500 Subject: [PATCH 35/35] update core with FIO7848 update, was having issues on bootstrap --- .github/workflows/ci.yml | 54 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c7b7938..f2b0b447 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: with: cmd: build - test: + test-current: needs: setup runs-on: ubuntu-latest steps: @@ -76,8 +76,56 @@ jobs: with: cmd: test + test-target: + needs: setup + runs-on: ubuntu-latest + steps: + - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Configure Git user + run: | + git config --global user.email "pkgbot@form.io" + git config --global user.name "pkgbot" + + - name: Merge target branch into current branch + run: | + git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }} + git merge ${{ github.event.pull_request.base.ref }} --no-commit --no-ff + + - name: Check for merge conflicts + run: | + if ! git merge --no-commit --no-ff ${{ github.event.pull_request.base.ref }}; then + echo "Merge conflicts detected." + git merge --abort + exit 1 + else + echo "Merge successful." + fi + + - name: Set up Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'npm' + + - name: Restore node modules from cache + uses: actions/cache@v3 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Test + uses: borales/actions-yarn@v4 + with: + cmd: test + publish: - needs: [setup, test] + needs: [setup, test-current, test-target] if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') }} runs-on: ubuntu-latest steps: @@ -140,4 +188,4 @@ jobs: - name: Publish to npm run: | npm version $NEW_VERSION - npm publish --tag dev \ No newline at end of file + yarn publish --tag dev \ No newline at end of file