|
1 | | -# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created |
2 | | -# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages |
3 | | - |
4 | | -name: Publish to NPM and GCR |
5 | | - |
6 | | -on: |
7 | | - release: |
8 | | - types: [created] |
9 | | - |
10 | | -jobs: |
11 | | - test: |
12 | | - runs-on: ubuntu-latest |
13 | | - |
14 | | - steps: |
15 | | - - uses: actions/checkout@v2 |
16 | | - - uses: actions/cache@v2 |
17 | | - with: |
18 | | - path: | |
19 | | - ~/.npm |
20 | | - ~/.cache/firebase/emulators/ |
21 | | - key: ${{ runner.os }}-firestore-${{ hashFiles('**/package-lock.json') }} |
22 | | - restore-keys: | |
23 | | - ${{ runner.os }}-firestore- |
24 | | - - name: Use Node.js 14 |
25 | | - uses: actions/setup-node@v1 |
26 | | - with: |
27 | | - node-version: 14 |
28 | | - - uses: actions/setup-java@v2 |
29 | | - with: |
30 | | - distribution: "adopt" # See 'Supported distributions' for available options |
31 | | - java-version: "11" |
32 | | - - run: npm ci --prefer-offline |
33 | | - - run: npx firebase emulators:exec "npm run coverage" |
34 | | - |
35 | | - publish-npm: |
36 | | - needs: test |
37 | | - runs-on: ubuntu-latest |
38 | | - steps: |
39 | | - - uses: actions/checkout@v2 |
40 | | - - uses: actions/cache@v2 |
41 | | - with: |
42 | | - path: ~/.npm |
43 | | - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
44 | | - restore-keys: | |
45 | | - ${{ runner.os }}-node- |
46 | | - - uses: actions/setup-node@v2 |
47 | | - with: |
48 | | - node-version: 14 |
49 | | - registry-url: https://registry.npmjs.org/ |
50 | | - - run: npm ci --prefer-offline |
51 | | - - run: npm publish |
52 | | - env: |
53 | | - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
54 | | - |
55 | | - publish-gpr: |
56 | | - needs: test |
57 | | - runs-on: ubuntu-latest |
58 | | - steps: |
59 | | - - uses: actions/checkout@v2 |
60 | | - - uses: actions/cache@v2 |
61 | | - with: |
62 | | - path: ~/.npm |
63 | | - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
64 | | - restore-keys: | |
65 | | - ${{ runner.os }}-node- |
66 | | - - uses: actions/setup-node@v2 |
67 | | - with: |
68 | | - node-version: 14 |
69 | | - registry-url: https://npm.pkg.github.com/ |
70 | | - - run: npm ci --prefer-offline |
71 | | - - run: sed -i 's,"apollo-datasource-firestore","@swantzter/apollo-datasource-firestore",' package*.json |
72 | | - - run: npm publish |
73 | | - env: |
74 | | - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 1 | +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created |
| 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages |
| 3 | + |
| 4 | +name: Publish to NPM and GCR |
| 5 | + |
| 6 | +on: |
| 7 | + release: |
| 8 | + types: [created] |
| 9 | + |
| 10 | +jobs: |
| 11 | + test: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v2 |
| 16 | + - uses: actions/cache@v2 |
| 17 | + with: |
| 18 | + path: | |
| 19 | + ~/.npm |
| 20 | + ~/.cache/firebase/emulators/ |
| 21 | + key: ${{ runner.os }}-firestore-${{ hashFiles('**/package-lock.json') }} |
| 22 | + restore-keys: | |
| 23 | + ${{ runner.os }}-firestore- |
| 24 | + - name: Use Node.js 14 |
| 25 | + uses: actions/setup-node@v1 |
| 26 | + with: |
| 27 | + node-version: 14 |
| 28 | + - uses: actions/setup-java@v2 |
| 29 | + with: |
| 30 | + distribution: "adopt" # See 'Supported distributions' for available options |
| 31 | + java-version: "11" |
| 32 | + - run: npm ci --prefer-offline |
| 33 | + - run: npx firebase emulators:exec "npm run coverage" |
| 34 | + |
| 35 | + publish-npm: |
| 36 | + needs: test |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v2 |
| 40 | + - uses: actions/cache@v2 |
| 41 | + with: |
| 42 | + path: ~/.npm |
| 43 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 44 | + restore-keys: | |
| 45 | + ${{ runner.os }}-node- |
| 46 | + - uses: actions/setup-node@v2 |
| 47 | + with: |
| 48 | + node-version: 14 |
| 49 | + registry-url: https://registry.npmjs.org/ |
| 50 | + - run: npm ci --prefer-offline |
| 51 | + - run: npm publish |
| 52 | + env: |
| 53 | + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
| 54 | + |
| 55 | + publish-gpr: |
| 56 | + needs: test |
| 57 | + runs-on: ubuntu-latest |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v2 |
| 60 | + - uses: actions/cache@v2 |
| 61 | + with: |
| 62 | + path: ~/.npm |
| 63 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 64 | + restore-keys: | |
| 65 | + ${{ runner.os }}-node- |
| 66 | + - uses: actions/setup-node@v2 |
| 67 | + with: |
| 68 | + node-version: 14 |
| 69 | + registry-url: https://npm.pkg.github.com/ |
| 70 | + - run: npm ci --prefer-offline |
| 71 | + - run: sed -i 's,"apollo-datasource-firestore","@swantzter/apollo-datasource-firestore",' package*.json |
| 72 | + - run: npm publish |
| 73 | + env: |
| 74 | + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |
0 commit comments