This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate and Publish SDK | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
NODE_VERSION: 18.x | |
jobs: | |
generate-sdk: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
registry-url: "https://registry.npmjs.org/" | |
- name: Run docker-compose | |
run: | | |
cp CI/ESS/e2e/docker-compose.e2e.yaml docker-compose.yaml | |
docker compose pull | |
docker compose build --no-cache | |
docker compose up -d | |
- name: Wait for Backend | |
run: | | |
npm install -g wait-on | |
wait-on http://localhost:3000/api/v3/health --timeout 200000 | |
- name: Make generate-sdk-local.sh executable and run it | |
run: | | |
chmod +x ./scripts/generate-sdk-local.sh | |
./scripts/generate-sdk-local.sh | |
- name: Get path | |
run: pwd && ls -la | |
- name: Fix permissions | |
run: sudo chown -R $USER:$USER ./sdk | |
- name: Prepare SDK for publishing | |
run: | | |
npm init -y | |
jq '.name="@scicat-sdk/typescript-angular" | .version="0.0.3" | .main="index.js" | .author="Jay" | .license="MIT" | .private=false' package.json > temp.json && mv temp.json package.json | |
working-directory: ./sdk | |
- name: Publish SDK to npm | |
run: | | |
npm install | |
npm run build | |
npm publish dist --access public | |
working-directory: ./sdk | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |