on: push: #branches: # master pull_request: env: NODE_VERSION: 16 jobs: setup: runs-on: ubuntu-latest name: Setup steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 id: node-setup with: node-version: ${{ env.NODE_VERSION }} - uses: actions/cache@v2 id: cache-restore with: path: | .yarn key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} - name: Install dependencies if: steps.cache-restore.outputs.cache-hit != 'true' run: yarn build: runs-on: ubuntu-latest name: Build needs: setup steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 id: node-setup with: node-version: ${{ env.NODE_VERSION }} - name: Yarn cache uses: actions/cache@v2 id: yarn-cache-restore with: path: | .yarn key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} - name: Parcel cache uses: actions/cache@v2 id: parcel-cache-restore with: path: | .parcel-cache key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}-parcel - run: | yarn yarn build - name: Build Artifacts uses: actions/upload-artifact@v2 with: name: build-artifacts path: dist preview: runs-on: ubuntu-latest name: Deploy preview needs: build steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 id: node-setup with: node-version: ${{ env.NODE_VERSION }} - name: Build Artifacts uses: actions/download-artifact@v2 with: name: build-artifacts path: dist - name: Netlify CLI setup run: npm install -g netlify-cli - name: Deploy id: preview-deploy env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} run: | netlify deploy --dir=dist --json > output.log export NETLIFY_STDOUT=$(cat output.log) - name: Report uses: actions/github-script@v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | github.issues.createComment({ issue_number: context.paylod.pull_request.number, owner: context.repo.owner, repo: context.repo.repo, body: process.env.NETLIFY_STDOUT })