|
| 1 | +name: 'dhis2: verify (node)' |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + |
| 7 | +env: |
| 8 | + GIT_AUTHOR_NAME: '@dhis2-bot' |
| 9 | + GIT_AUTHOR_EMAIL: 'apps@dhis2.org' |
| 10 | + GIT_COMMITTER_NAME: '@dhis2-bot' |
| 11 | + GIT_COMMITTER_EMAIL: 'apps@dhis2.org' |
| 12 | + NPM_TOKEN: ${{secrets.DHIS2_BOT_NPM_TOKEN}} |
| 13 | + GH_TOKEN: ${{secrets.DHIS2_BOT_GITHUB_TOKEN}} |
| 14 | + CI: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + install: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + if: "!contains(github.event.head_commit.message, '[skip ci]')" |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + - uses: actions/setup-node@v1 |
| 24 | + with: |
| 25 | + node-version: 12.x |
| 26 | + |
| 27 | + - uses: actions/cache@v2 |
| 28 | + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) |
| 29 | + with: |
| 30 | + path: '**/node_modules' |
| 31 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 32 | + |
| 33 | + - name: Install |
| 34 | + if: steps.yarn-cache.outputs.cache-hit != 'true' |
| 35 | + run: yarn install --frozen-lockfile |
| 36 | + |
| 37 | + lint: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + needs: install |
| 40 | + if: "!contains(github.event.head_commit.message, '[skip ci]')" |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v2 |
| 43 | + - uses: actions/setup-node@v1 |
| 44 | + with: |
| 45 | + node-version: 12.x |
| 46 | + |
| 47 | + - uses: actions/cache@v2 |
| 48 | + id: yarn-cache |
| 49 | + with: |
| 50 | + path: '**/node_modules' |
| 51 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 52 | + |
| 53 | + - name: Lint |
| 54 | + run: yarn lint |
| 55 | + |
| 56 | + test: |
| 57 | + runs-on: ubuntu-latest |
| 58 | + needs: install |
| 59 | + if: "!contains(github.event.head_commit.message, '[skip ci]')" |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v2 |
| 62 | + - uses: actions/setup-node@v1 |
| 63 | + with: |
| 64 | + node-version: 12.x |
| 65 | + |
| 66 | + - uses: actions/cache@v2 |
| 67 | + id: yarn-cache |
| 68 | + with: |
| 69 | + path: '**/node_modules' |
| 70 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 71 | + |
| 72 | + - name: Smoke |
| 73 | + run: ./packages/main/bin/d2 debug system |
| 74 | + |
| 75 | + - name: Test |
| 76 | + run: yarn test |
| 77 | + |
| 78 | + publish: |
| 79 | + runs-on: ubuntu-latest |
| 80 | + needs: [install, lint, test] |
| 81 | + if: "!contains(github.event.head_commit.message, '[skip ci]')" |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v2 |
| 84 | + with: |
| 85 | + token: ${{env.GH_TOKEN}} |
| 86 | + - uses: actions/setup-node@v1 |
| 87 | + with: |
| 88 | + node-version: 12.x |
| 89 | + |
| 90 | + - name: Publish to NPM |
| 91 | + run: ./packages/main/bin/d2 utils release --publish npm |
0 commit comments