name: CI on: push: branches: [main] workflow_dispatch: inputs: run_deploy: description: 'Publish?' type: boolean default: false jobs: build: runs-on: [docker] steps: - name: Checkout code uses: actions/checkout@v3 - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: '20' - name: Install dependencies run: npm ci - name: Build run: npm run build - name: Upload artifact uses: actions/upload-artifact@v3 with: name: gxc-renderer-base-${{ github.sha }} path: ./dist/ deploy: needs: build runs-on: [docker] steps: - name: Download artifact if: ${{ github.event.inputs.run_deploy == 'true' }} uses: actions/download-artifact@v3 with: name: gxc-renderer-base-${{ github.sha }} path: ./artifact - name: Setup Node.js if: ${{ github.event.inputs.run_deploy == 'true' }} uses: actions/setup-node@v3 with: node-version: '20' - name: NPM Login if: ${{ github.event.inputs.run_deploy == 'true' }} run: | echo "//${{ vars.VERDACCIO_URL }}/:_authToken=${{ secrets.VERDACCIO_TOKEN }}" > ~/.npmrc npm whoami env: VERDACCIO_URL: ${{ vars.VERDACCIO_URL }} VERDACCIO_TOKEN: ${{ secrets.VERDACCIO_TOKEN }} - name: Publish to NPM if: ${{ github.event.inputs.run_deploy == 'true' }} run: npm publish ./artifact --registry ${{ vars.VERDACCIO_URL }} env: VERDACCIO_URL: ${{ vars.VERDACCIO_URL }}