name: CI on: push: pull_request: jobs: Build: runs-on: ubuntu-20.04 steps: - name: Checkout repository uses: actions/checkout@v2 - name: Set up Node.js uses: actions/setup-node@v2 with: node-version: 12 - id: cache-node-modules name: Download cache uses: actions/cache@v2 with: path: node_modules key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} - name: Install dependencies if: steps.cache-node-modules.outputs.cache-hit != 'true' run: yarn install - name: ESLint run: yarn lint - name: TypeScript run: yarn tsc - name: Build run: yarn build - name: Upload build artifacts uses: actions/upload-artifact@v2 with: name: build path: dist retention-days: 7 Docker: runs-on: ubuntu-20.04 if: github.event_name == 'push' && github.ref == 'refs/heads/master' steps: - name: Login to the GitHub Container Registry uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v2 with: target: app tags: ghcr.io/${{ github.repository }}:latest push: true cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:latest cache-to: type=inline