|
| 1 | +name: cd-dgraph-js-http |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + releasetag: |
| 6 | + description: "git tag to checkout and version to publish to npm" |
| 7 | + required: true |
| 8 | + type: string |
| 9 | +jobs: |
| 10 | + dgraph-js-http-tests: |
| 11 | + runs-on: ubuntu-20.04 |
| 12 | + strategy: |
| 13 | + fail-fast: true |
| 14 | + matrix: |
| 15 | + node-version: [16.x, 18.x, 19.x, 20.x] |
| 16 | + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ |
| 17 | + steps: |
| 18 | + - name: Checkout dgraph-js-http repo |
| 19 | + uses: actions/checkout@v3 |
| 20 | + with: |
| 21 | + path: dgraph-js-http |
| 22 | + repository: dgraph-io/dgraph-js-http |
| 23 | + ref: ${{ github.event.inputs.releasetag }} |
| 24 | + - name: Checkout dgraph repo |
| 25 | + uses: actions/checkout@v3 |
| 26 | + with: |
| 27 | + path: dgraph |
| 28 | + repository: dgraph-io/dgraph |
| 29 | + ref: main |
| 30 | + - name: Get Go Version |
| 31 | + run: | |
| 32 | + #!/bin/bash |
| 33 | + cd dgraph |
| 34 | + GOVERSION=$({ [ -f .go-version ] && cat .go-version; }) |
| 35 | + echo "GOVERSION=$GOVERSION" >> $GITHUB_ENV |
| 36 | + - name: Set up Go |
| 37 | + uses: actions/setup-go@v3 |
| 38 | + with: |
| 39 | + go-version: ${{ env.GOVERSION }} |
| 40 | + - name: Build dgraph binary |
| 41 | + run: cd dgraph && make docker-image # also builds dgraph binary |
| 42 | + - name: Move dgraph binary to gopath |
| 43 | + run: cd dgraph && mv dgraph/dgraph ~/go/bin/dgraph |
| 44 | + - name: Setup node.js ${{ matrix.node-version }} |
| 45 | + uses: actions/setup-node@v3 |
| 46 | + with: |
| 47 | + node-version: ${{ matrix.node-version }} |
| 48 | + cache: 'npm' |
| 49 | + cache-dependency-path: dgraph-js-http/package-lock.json |
| 50 | + - name: Run dgraph-js-http tests |
| 51 | + working-directory: dgraph-js-http |
| 52 | + run: | |
| 53 | + npm ci --legacy-peer-deps |
| 54 | + bash scripts/run-tests.sh |
| 55 | +
|
| 56 | + dgraph-js-http-publish-npm: |
| 57 | + needs: [dgraph-js-http-tests] |
| 58 | + runs-on: ubuntu-20.04 |
| 59 | + steps: |
| 60 | + - name: Checkout dgraph-js-http repo |
| 61 | + uses: actions/checkout@v3 |
| 62 | + - name: Setup node.js |
| 63 | + uses: actions/setup-node@v3 |
| 64 | + with: |
| 65 | + node-version: '20.x' |
| 66 | + registry-url: 'https://registry.npmjs.org' |
| 67 | + - name: Build dgraph-js-http package |
| 68 | + run: npm ci --legacy-peer-deps |
| 69 | + - run: npm publish |
| 70 | + env: |
| 71 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 72 | + |
0 commit comments