|
| 1 | +name: Build and release |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + tags: |
| 7 | + - v* |
| 8 | + pull_request: |
| 9 | + |
| 10 | +jobs: |
| 11 | + setup-build-publish-deploy: |
| 12 | + name: Setup, Build, Publish, and Deploy |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v2 |
| 17 | + - name: Use Node.js ${{ matrix.node-version }} |
| 18 | + uses: actions/setup-node@v2 |
| 19 | + with: |
| 20 | + node-version: 16 |
| 21 | + - run: bash .ci/install_dependencies.sh |
| 22 | + - name: Build |
| 23 | + if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'pull_request' }} |
| 24 | + run: | |
| 25 | + cd packages/tdb-dashboard |
| 26 | + echo ' |
| 27 | + CONNECTION_TYPE="REMOTE" |
| 28 | + TERMINUSDB_SERVER="https://cloud-dev.terminusdb.com/" |
| 29 | + FEEDBACK_URL="https://cloud-dev.terminusdb.com/" |
| 30 | + REACT_APP_BASE_ROUTER="" |
| 31 | + AUTH0_CLIENT_ID="s6iYFJzoSedUHGUUaRYCGGWXWEPHkd02" |
| 32 | + AUTH0_DOMAIN="signup-dev.terminusdb.com" |
| 33 | + AUDIENCE="https://terminuscloud/users" |
| 34 | + ' > .env |
| 35 | + npm run build |
| 36 | + - name: Build prod |
| 37 | + if: startsWith(github.ref, 'refs/tags/v') |
| 38 | + run: | |
| 39 | + cd packages/tdb-dashboard |
| 40 | + echo ' |
| 41 | + CONNECTION_TYPE="REMOTE" |
| 42 | + TERMINUSDB_SERVER="https://cloud.terminusdb.com/" |
| 43 | + FEEDBACK_URL="https://cloud.terminusdb.com/" |
| 44 | + REACT_APP_BASE_ROUTER="" |
| 45 | + AUTH0_CLIENT_ID="365PsB0AmUmB2odSFwezWkX31BZv6PoH" |
| 46 | + AUTH0_DOMAIN="signup.terminusdb.com" |
| 47 | + AUDIENCE="https://terminuscloud/users" |
| 48 | + ' > .env |
| 49 | + npm run build |
| 50 | + - name: Set up Cloud SDK |
| 51 | + uses: google-github-actions/setup-gcloud@v0 |
| 52 | + with: |
| 53 | + project_id: ${{ secrets.GCLOUD_PROJECT }} |
| 54 | + service_account_key: ${{ secrets.GCLOUD_SERVICE_ACCOUNT_KEY }} |
| 55 | + export_default_credentials: true |
| 56 | +# - name: Upload tdb-dashboard dev |
| 57 | +# if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }} |
| 58 | +# run: gsutil -h "Cache-Control:public, max-age=60" cp -r packages/tdb-dashboard/dist/* "gs://${{ secrets.GCLOUD_DEV_BUCKET }}/" |
| 59 | +# - name: Upload tdb-dashboard prod |
| 60 | +# if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }} |
| 61 | +# run: gsutil -h "Cache-Control:public, max-age=60" cp -r packages/tdb-dashboard/dist/* "gs://${{ secrets.GCLOUD_BUCKET }}/" |
| 62 | +# - name: Clean cloudflare cache |
| 63 | +# if: ${{ github.event_name != 'pull_request' }} |
| 64 | +# run: python3 .ci/clean_cloudflare_cache.py ${{ github.ref }} |
| 65 | +# env: |
| 66 | +# CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }} |
| 67 | +# CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }} |
| 68 | +# CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }} |
| 69 | + |
| 70 | + build_for_local: |
| 71 | + name: Build local dashboard |
| 72 | + runs-on: ubuntu-latest |
| 73 | + steps: |
| 74 | + - name: Checkout |
| 75 | + uses: actions/checkout@v2 |
| 76 | + - name: Use Node.js ${{ matrix.node-version }} |
| 77 | + uses: actions/setup-node@v2 |
| 78 | + with: |
| 79 | + node-version: 16 |
| 80 | + - run: bash .ci/install_dependencies.sh |
| 81 | + if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/v') }} |
| 82 | + run: | |
| 83 | + cd packages/tdb-dashboard |
| 84 | + echo ' |
| 85 | + CONNECTION_TYPE="LOCAL" |
| 86 | + TERMINUSDB_SERVER=http://127.0.0.1:6363/ |
| 87 | + TERMINUSDB_KEY=root |
| 88 | + FEEDBACK_URL="https://cloud.terminusdb.com/" |
| 89 | + BASE_URL="dashboard" |
| 90 | + ' > .env |
| 91 | + npm run build |
| 92 | + cd dist |
| 93 | + tar caf release.tar.gz * |
| 94 | +
|
| 95 | + - name: Create Release |
| 96 | + if: startsWith(github.ref, 'refs/tags/v') |
| 97 | + |
| 98 | + with: |
| 99 | + artifacts: packages/tdb-dashboard/dist/release.tar.gz |
0 commit comments