|
| 1 | +name: Continuous Deployment |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + checks: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + |
| 11 | + steps: |
| 12 | + - name: Checkout default branch |
| 13 | + uses: actions/checkout@v2 |
| 14 | + |
| 15 | + - name: Use Node.js 16 |
| 16 | + uses: actions/setup-node@v2 |
| 17 | + with: |
| 18 | + node-version: 16 |
| 19 | + |
| 20 | + - name: Cache dependencies |
| 21 | + id: npm_cache |
| 22 | + uses: actions/cache@v2 |
| 23 | + with: |
| 24 | + path: '**/node_modules' |
| 25 | + key: node16-${{ hashFiles('package-lock.json') }} |
| 26 | + |
| 27 | + - name: Install dependencies |
| 28 | + if: steps.npm_cache.outputs.cache-hit != 'true' |
| 29 | + run: npm ci |
| 30 | + |
| 31 | + - name: Lint and fix code |
| 32 | + run: npm run lint |
| 33 | + |
| 34 | + - name: Typecheck |
| 35 | + run: npm run typecheck |
| 36 | + |
| 37 | + publish: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + |
| 40 | + needs: checks |
| 41 | + |
| 42 | + permissions: |
| 43 | + packages: write |
| 44 | + contents: read |
| 45 | + |
| 46 | + steps: |
| 47 | + - name: Checkout default branch |
| 48 | + uses: actions/checkout@v2 |
| 49 | + |
| 50 | + - name: Use Node.js 16 (npm repository) |
| 51 | + uses: actions/setup-node@v2 |
| 52 | + with: |
| 53 | + node-version: 16 |
| 54 | + registry-url: 'https://registry.npmjs.org' |
| 55 | + |
| 56 | + - name: Cache dependencies |
| 57 | + id: npm_cache |
| 58 | + uses: actions/cache@v2 |
| 59 | + with: |
| 60 | + path: '**/node_modules' |
| 61 | + key: node16-${{ hashFiles('package-lock.json') }} |
| 62 | + |
| 63 | + - name: Install dependencies |
| 64 | + if: steps.npm_cache.outputs.cache-hit != 'true' |
| 65 | + run: npm ci |
| 66 | + |
| 67 | + - name: Build Frontify Authenticator |
| 68 | + run: npm run build |
| 69 | + |
| 70 | + - name: Publish to npm |
| 71 | + run: npm publish --access public |
| 72 | + env: |
| 73 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 74 | + |
| 75 | + - name: Use Node.js 16 (GitHub repository) |
| 76 | + uses: actions/setup-node@v2 |
| 77 | + with: |
| 78 | + registry-url: 'https://npm.pkg.github.com' |
| 79 | + node-version: 16 |
| 80 | + |
| 81 | + - name: Publish to GitHub Packages |
| 82 | + run: npm publish --access public |
| 83 | + env: |
| 84 | + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments