name: Deploy to Github Pages / Docker hub on: push: branches: - master paths: - src/** - public/** - Dockerfile - package.json - tsconfig.json - next.config.js - .github/workflows/** jobs: test: runs-on: ubuntu-latest steps: - name: Setup uses: actions/checkout@v2 - name: Setup Node.js uses: actions/setup-node@v1 with: node-version: "16.x" cache: "yarn" - name: Install npm dependencies run: yarn install - name: Lint run: yarn run lint env: NEXT_TELEMETRY_DISABLED: 1 - name: Build website run: yarn run export env: NODE_ENV: production NEXT_TELEMETRY_DISABLED: 1 - uses: actions/upload-artifact@v3 with: name: output path: out pages: runs-on: ubuntu-latest needs: test steps: - name: Setup uses: actions/checkout@v2 - name: Setup Node.js uses: actions/setup-node@v1 with: node-version: "16.x" cache: "yarn" - name: Install npm dependencies run: yarn install - name: Build website run: yarn run export env: NODE_ENV: production NEXT_TELEMETRY_DISABLED: 1 BASE_PATH: /MaterialTube - name: Deploy to pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./out docker: runs-on: ubuntu-latest needs: test steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 # Login - name: Login to DockerHub uses: docker/login-action@v1 with: username: guusvanmeerveld password: ${{ secrets.DOCKERHUB_TOKEN }} # Build & Push - name: Build Dockerfile and push uses: docker/build-push-action@v2 with: push: true tags: guusvanmeerveld/materialtube:latest # Cache cache-from: type=gha cache-to: type=gha,mode=max