From a12e27d2f2f0d8024c7a65194803dbda2d240f90 Mon Sep 17 00:00:00 2001 From: GPortas Date: Mon, 23 Sep 2024 12:39:13 +0200 Subject: [PATCH 01/12] Stash: deploy_alpha github action WIP --- .github/workflows/deploy_alpha.yml | 100 +++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .github/workflows/deploy_alpha.yml diff --git a/.github/workflows/deploy_alpha.yml b/.github/workflows/deploy_alpha.yml new file mode 100644 index 00000000..555172be --- /dev/null +++ b/.github/workflows/deploy_alpha.yml @@ -0,0 +1,100 @@ +name: 'deploy_alpha' + +on: + push: + branches: + - placeholder_branch + +jobs: + test-unit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 19 + + - name: Install npm dependencies + run: npm ci + + - name: Run unit tests + run: npm run test:unit + + test-integration: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 19 + + - name: Install npm dependencies + run: npm ci + + - name: Run integration tests + run: npm run test:integration + + test-functional: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 19 + + - name: Install npm dependencies + run: npm ci + + - name: Run functional tests + run: npm run test:functional + + publish-gpr: + needs: [test-unit, test-integration, test-functional] + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 19 + registry-url: https://npm.pkg.github.com/ + + - name: Install npm dependencies + run: npm ci + + - name: Build package + run: npm run build + + - name: Update package version + run: | + # Fetch or initialize the version counter + if [ ! -f .alpha_version ]; then + echo "1" > .alpha_version + fi + INCREMENTAL_NUMBER=$(cat .alpha_version) + + # Increment version number + NEW_INCREMENTAL_NUMBER=$((INCREMENTAL_NUMBER+1)) + + # Save the new incremental number to the file + echo "${NEW_INCREMENTAL_NUMBER}" > .alpha_version + + # Update package version with 2.0.0.alpha. + NEW_VERSION="2.0.0.alpha.${INCREMENTAL_NUMBER}" + npm version "${NEW_VERSION}" --no-git-tag-version + + # Commit the version update and incremental number + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "GitHub Actions" + git add package.json .alpha_version + git commit -m "Update version to ${NEW_VERSION}" + + - name: Publish package + run: | + echo "$(jq '.publishConfig.registry = "https://npm.pkg.github.com"' package.json)" > package.json + echo "$( jq '.name = "@IQSS/dataverse-client-javascript"' package.json )" > package.json + npm publish --@IQSS:registry=https://npm.pkg.github.com + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From fe0ebcf2f660364e625a7ec0a2286683ee72ad6e Mon Sep 17 00:00:00 2001 From: GPortas Date: Mon, 23 Sep 2024 12:52:12 +0200 Subject: [PATCH 02/12] Fixed: deploy_alpha.yml format --- .github/workflows/deploy_alpha.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy_alpha.yml b/.github/workflows/deploy_alpha.yml index 555172be..65b607d9 100644 --- a/.github/workflows/deploy_alpha.yml +++ b/.github/workflows/deploy_alpha.yml @@ -74,17 +74,17 @@ jobs: echo "1" > .alpha_version fi INCREMENTAL_NUMBER=$(cat .alpha_version) - + # Increment version number NEW_INCREMENTAL_NUMBER=$((INCREMENTAL_NUMBER+1)) - + # Save the new incremental number to the file echo "${NEW_INCREMENTAL_NUMBER}" > .alpha_version - + # Update package version with 2.0.0.alpha. NEW_VERSION="2.0.0.alpha.${INCREMENTAL_NUMBER}" npm version "${NEW_VERSION}" --no-git-tag-version - + # Commit the version update and incremental number git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "GitHub Actions" From d8f71b479dfb8fe4c697b53f411dcac9e88e12f9 Mon Sep 17 00:00:00 2001 From: GPortas Date: Mon, 23 Sep 2024 12:57:52 +0200 Subject: [PATCH 03/12] Added: deploy_alpha temporal values for testing --- .github/workflows/deploy_alpha.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy_alpha.yml b/.github/workflows/deploy_alpha.yml index 65b607d9..6c532eda 100644 --- a/.github/workflows/deploy_alpha.yml +++ b/.github/workflows/deploy_alpha.yml @@ -3,7 +3,7 @@ name: 'deploy_alpha' on: push: branches: - - placeholder_branch + - 188-deploy-latest-develop-version jobs: test-unit: @@ -82,7 +82,7 @@ jobs: echo "${NEW_INCREMENTAL_NUMBER}" > .alpha_version # Update package version with 2.0.0.alpha. - NEW_VERSION="2.0.0.alpha.${INCREMENTAL_NUMBER}" + NEW_VERSION="2.0.0.alpha.test.${INCREMENTAL_NUMBER}" npm version "${NEW_VERSION}" --no-git-tag-version # Commit the version update and incremental number From 55bdeb853b074f802673b4df88cf60ccc0c01124 Mon Sep 17 00:00:00 2001 From: GPortas Date: Mon, 23 Sep 2024 13:07:14 +0200 Subject: [PATCH 04/12] Fixed: version format in deploy_alpha.yml --- .github/workflows/deploy_alpha.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy_alpha.yml b/.github/workflows/deploy_alpha.yml index 6c532eda..e37b85d0 100644 --- a/.github/workflows/deploy_alpha.yml +++ b/.github/workflows/deploy_alpha.yml @@ -82,7 +82,7 @@ jobs: echo "${NEW_INCREMENTAL_NUMBER}" > .alpha_version # Update package version with 2.0.0.alpha. - NEW_VERSION="2.0.0.alpha.test.${INCREMENTAL_NUMBER}" + NEW_VERSION="2.0.0.test.${INCREMENTAL_NUMBER}" npm version "${NEW_VERSION}" --no-git-tag-version # Commit the version update and incremental number From abf09440e2fc1123ecd3a5243b237330ebbaf874 Mon Sep 17 00:00:00 2001 From: GPortas Date: Mon, 23 Sep 2024 13:15:58 +0200 Subject: [PATCH 05/12] Fixed: version format in deploy_alpha.yml --- .github/workflows/deploy_alpha.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy_alpha.yml b/.github/workflows/deploy_alpha.yml index e37b85d0..f514f593 100644 --- a/.github/workflows/deploy_alpha.yml +++ b/.github/workflows/deploy_alpha.yml @@ -82,7 +82,7 @@ jobs: echo "${NEW_INCREMENTAL_NUMBER}" > .alpha_version # Update package version with 2.0.0.alpha. - NEW_VERSION="2.0.0.test.${INCREMENTAL_NUMBER}" + NEW_VERSION="2.0.0-test.${INCREMENTAL_NUMBER}" npm version "${NEW_VERSION}" --no-git-tag-version # Commit the version update and incremental number From d83142d0ff0d4f3516b7ac00af756a68579ef478 Mon Sep 17 00:00:00 2001 From: GPortas Date: Mon, 23 Sep 2024 13:36:24 +0200 Subject: [PATCH 06/12] Fixed: missing git push in deploy_alpha.yml added --- .github/workflows/deploy_alpha.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy_alpha.yml b/.github/workflows/deploy_alpha.yml index f514f593..0db745ad 100644 --- a/.github/workflows/deploy_alpha.yml +++ b/.github/workflows/deploy_alpha.yml @@ -81,8 +81,8 @@ jobs: # Save the new incremental number to the file echo "${NEW_INCREMENTAL_NUMBER}" > .alpha_version - # Update package version with 2.0.0.alpha. - NEW_VERSION="2.0.0-test.${INCREMENTAL_NUMBER}" + # Update package version with 2.0.0-alpha. + NEW_VERSION="2.0.0-test1.${INCREMENTAL_NUMBER}" npm version "${NEW_VERSION}" --no-git-tag-version # Commit the version update and incremental number @@ -91,6 +91,9 @@ jobs: git add package.json .alpha_version git commit -m "Update version to ${NEW_VERSION}" + # Push the changes to the repository + git push origin develop + - name: Publish package run: | echo "$(jq '.publishConfig.registry = "https://npm.pkg.github.com"' package.json)" > package.json From 324e7cd61a8f647e36f0eef153a70e9627031bc9 Mon Sep 17 00:00:00 2001 From: GPortas Date: Mon, 23 Sep 2024 13:41:37 +0200 Subject: [PATCH 07/12] Fixed: using github.ref_name in deploy_alpha --- .github/workflows/deploy_alpha.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy_alpha.yml b/.github/workflows/deploy_alpha.yml index 0db745ad..7f04d255 100644 --- a/.github/workflows/deploy_alpha.yml +++ b/.github/workflows/deploy_alpha.yml @@ -92,7 +92,7 @@ jobs: git commit -m "Update version to ${NEW_VERSION}" # Push the changes to the repository - git push origin develop + git push origin "${{ github.ref_name }}" - name: Publish package run: | From 3c5b2a5eda30a2194bd8159e905df9916ed0a2bc Mon Sep 17 00:00:00 2001 From: GPortas Date: Mon, 23 Sep 2024 14:00:44 +0200 Subject: [PATCH 08/12] Fixed: perms in deploy_alpha.yml --- .github/workflows/deploy_alpha.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy_alpha.yml b/.github/workflows/deploy_alpha.yml index 7f04d255..b38592f3 100644 --- a/.github/workflows/deploy_alpha.yml +++ b/.github/workflows/deploy_alpha.yml @@ -53,7 +53,7 @@ jobs: runs-on: ubuntu-latest permissions: packages: write - contents: read + contents: write steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -68,6 +68,8 @@ jobs: run: npm run build - name: Update package version + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | # Fetch or initialize the version counter if [ ! -f .alpha_version ]; then From 5f1012f4dc6194fe7c0cdebbd9cc37f88315e4c4 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 23 Sep 2024 12:05:07 +0000 Subject: [PATCH 09/12] Update version to 2.0.0-test1.1 --- .alpha_version | 1 + package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 .alpha_version diff --git a/.alpha_version b/.alpha_version new file mode 100644 index 00000000..0cfbf088 --- /dev/null +++ b/.alpha_version @@ -0,0 +1 @@ +2 diff --git a/package-lock.json b/package-lock.json index a9537e84..c1d68745 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "js-dataverse", - "version": "2.0.0", + "version": "2.0.0-test1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "js-dataverse", - "version": "2.0.0", + "version": "2.0.0-test1.1", "license": "MIT", "dependencies": { "@types/node": "^18.15.11", diff --git a/package.json b/package.json index 5b051d81..9d4445ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "js-dataverse", - "version": "2.0.0", + "version": "2.0.0-test1.1", "description": "Dataverse API wrapper package for JavaScript/TypeScript-based applications", "main": "./dist/index.js", "types": "./dist/index.d.ts", From c13c204340e7650163478cdd585e36e9d8ca68a5 Mon Sep 17 00:00:00 2001 From: GPortas Date: Mon, 23 Sep 2024 14:52:47 +0200 Subject: [PATCH 10/12] Changed: replaced test values in deploy_alpha.yml with actual ones --- .alpha_version | 1 - .github/workflows/deploy_alpha.yml | 4 ++-- package.json | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 .alpha_version diff --git a/.alpha_version b/.alpha_version deleted file mode 100644 index 0cfbf088..00000000 --- a/.alpha_version +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/.github/workflows/deploy_alpha.yml b/.github/workflows/deploy_alpha.yml index b38592f3..985cc4aa 100644 --- a/.github/workflows/deploy_alpha.yml +++ b/.github/workflows/deploy_alpha.yml @@ -3,7 +3,7 @@ name: 'deploy_alpha' on: push: branches: - - 188-deploy-latest-develop-version + - develop jobs: test-unit: @@ -84,7 +84,7 @@ jobs: echo "${NEW_INCREMENTAL_NUMBER}" > .alpha_version # Update package version with 2.0.0-alpha. - NEW_VERSION="2.0.0-test1.${INCREMENTAL_NUMBER}" + NEW_VERSION="2.0.0-alpha.${INCREMENTAL_NUMBER}" npm version "${NEW_VERSION}" --no-git-tag-version # Commit the version update and incremental number diff --git a/package.json b/package.json index 9d4445ad..5b051d81 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "js-dataverse", - "version": "2.0.0-test1.1", + "version": "2.0.0", "description": "Dataverse API wrapper package for JavaScript/TypeScript-based applications", "main": "./dist/index.js", "types": "./dist/index.d.ts", From e2e35606e14bd93aa7c6e4bdc1d570643df1db81 Mon Sep 17 00:00:00 2001 From: GPortas Date: Mon, 23 Sep 2024 14:55:22 +0200 Subject: [PATCH 11/12] Changed: reverted package-lock version change --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index c1d68745..a9537e84 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "js-dataverse", - "version": "2.0.0-test1.1", + "version": "2.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "js-dataverse", - "version": "2.0.0-test1.1", + "version": "2.0.0", "license": "MIT", "dependencies": { "@types/node": "^18.15.11", From bb0dd8d5674f86eaf781baafac1ee18047748452 Mon Sep 17 00:00:00 2001 From: GPortas Date: Mon, 23 Sep 2024 15:11:25 +0200 Subject: [PATCH 12/12] Changed: docs/installation.md to describe different package versions --- docs/installation.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/installation.md b/docs/installation.md index 14e1e91c..8148653c 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -18,6 +18,19 @@ An unstable 2.x version of this package with breaking changes is under developme Until a 2.0 version is officially released, it can be installed from https://github.com/IQSS/dataverse-client-javascript/pkgs/npm/dataverse-client-javascript +Two different versions are being pushed to the GitHub Packages registry: + +1. **PR-Generated Versions**: + + - These versions are generated from pull request commits. + - They follow the structure `2.0.0-pr.`, where `pr_number` is the number of the pull request, and `commit_hash` is the specific commit hash from the PR branch. + - These versions are unstable and correspond to the state of the package during the pull request. + +2. **Develop Alpha Versions**: + - These versions are generated on every commit made to the `develop` branch, ideally after each pull request is merged. + - They follow the structure `2.0.0-alpha.`, where `number` is an incremental value that starts at 1 and increases with each build. + - These versions are also unstable and represent the latest work in progress on the `develop` branch. + ### Create a `.npmrc` file and add a token To install the [@iqss/dataverse-client-javascript](https://github.com/IQSS/dataverse-client-javascript/pkgs/npm/dataverse-client-javascript)