Skip to content

Commit

Permalink
Merge pull request #1558 from SciCatProject/master
Browse files Browse the repository at this point in the history
Release 11-12-2024
  • Loading branch information
Junjiequan authored Jan 6, 2025
2 parents faaf0ca + 097dba8 commit cf00c77
Show file tree
Hide file tree
Showing 18 changed files with 1,420 additions and 673 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,5 @@ ES_PASSWORD="duo-password"
ES_REFRESH=<"wait_for"|"false">

LOGGERS_CONFIG_FILE="loggers.json"
DATASET_TYPES_FILE="datasetTypes.json"
PROPOSAL_TYPES_FILE="proposalTypes.json"
2 changes: 1 addition & 1 deletion .github/openapi/typescript-angular-config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"generatorName": "typescript-angular",
"npmName": "@scicatproject/scicat-sdk-ts",
"npmName": "@scicatproject/scicat-sdk-ts-angular",
"ngVersion": "16.2.12",
"withInterfaces": true
}
5 changes: 5 additions & 0 deletions .github/openapi/typescript-fetch-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"generatorName": "typescript-fetch",
"npmName": "@scicatproject/scicat-sdk-ts-fetch",
"supportsES6": true
}
26 changes: 15 additions & 11 deletions .github/workflows/release-and-publish-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,9 @@ jobs:
--git-repo-id scicat-backend-next \
--git-user-id SciCatProject \
-o ./sdk/${{ matrix.generator }} $(
if [ "${{ matrix.generator }}" == "typescript-angular" ]; then
if [ "${{ matrix.generator }}" == "typescript-angular" ] || [ "${{ matrix.generator }}" == "typescript-fetch" ]; then
echo "--additional-properties=npmVersion=${{ needs.build-release.outputs.new_tag}}";
elif [ "${{ matrix.generator }}" == "python" ]; then
echo "--additional-properties=packageVersion=${{ needs.build-release.outputs.new_tag}}";
elif [ "${{ matrix.generator }}" == "python-pydantic-v1" ]; then
elif [ "${{ matrix.generator }}" == "python" ] || [ "${{ matrix.generator }}" == "python-pydantic-v1" ]; then
echo "--additional-properties=packageVersion=${{ needs.build-release.outputs.new_tag}}";
fi
)
Expand All @@ -169,9 +167,12 @@ jobs:
npm-publish:
needs: generate-upload-sdk
runs-on: ubuntu-latest
strategy:
matrix:
sdk_type: [typescript-angular, typescript-fetch]
environment:
name: npm-sdk-package
url: https://www.npmjs.com/package/@scicatproject/scicat-sdk-ts
name: ${{ matrix.sdk_type }}-sdk-package
url: ${{ matrix.sdk_type == 'typescript-angular' && 'https://www.npmjs.com/package/@scicatproject/scicat-sdk-ts-angular' || 'https://www.npmjs.com/package/@scicatproject/scicat-sdk-ts-fetch' }}

steps:
- name: Checkout repository
Expand All @@ -183,19 +184,22 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://registry.npmjs.org/"

- name: Download TypeScript Angular SDK Artifact
- name: Download TypeScript SDK Artifact
uses: actions/download-artifact@v4
with:
name: sdk-typescript-angular-${{github.sha}}
name: sdk-${{ matrix.sdk_type }}-${{ github.sha }}
path: ./sdk

- name: Publish package
run: |
npm install
npm run build
cd dist
if [ "${{ matrix.sdk_type }}" == "typescript-angular" ]; then
# publish dist folder for typescript-angular
cd dist
fi
npm publish --access public
working-directory: ./sdk/typescript-angular/
working-directory: ./sdk/${{ matrix.sdk_type }}/
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand Down Expand Up @@ -223,7 +227,7 @@ jobs:
- name: Download Python SDK Artifact
uses: actions/download-artifact@v4
with:
name: sdk-${{ matrix.sdk_type }}-${{github.sha}}
name: sdk-${{ matrix.sdk_type }}-${{ github.sha }}
path: ./sdk

- name: Install dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ jobs:
run: |
cp CI/ESS/docker-compose.api.yaml docker-compose.yaml
cp functionalAccounts.json.test functionalAccounts.json
cp datasetTypes.example.json datasetTypes.json
cp proposalTypes.example.json proposalTypes.json
docker compose up --build -d
npm run test:api
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/dist
/node_modules
functionalAccounts.json
datasetTypes.json
proposalTypes.json
loggers.json

Expand Down
3 changes: 3 additions & 0 deletions datasetTypes.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Custom": "custom"
}
31 changes: 31 additions & 0 deletions migrations/20241202105905-multiple-principal-investigators.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
async up(db, client) {
await db.collection("Dataset").updateMany({}, [
{
$set: {
principalInvestigators: ["$principalInvestigator"],
},
},
]);

await db
.collection("Dataset")
.updateMany({}, { $unset: { principalInvestigator: "" } });
},

async down(db, client) {
await db.collection("Dataset").updateMany({}, [
{
$set: {
principalInvestigator: {
$arrayElemAt: ["$principalInvestigators", 0],
},
},
},
]);

await db
.collection("Dataset")
.updateMany({}, { $unset: { principalInvestigators: "" } });
},
};
Loading

0 comments on commit cf00c77

Please sign in to comment.