From 27443a1174c7f7d8a34df96fe540b49e700eb992 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Fri, 16 Feb 2024 00:14:30 -0500 Subject: [PATCH] ci(deps): update actions to latest versions fix: ensure bootstrap script catches CI env --- .github/workflows/main.yml | 56 +++++++++++++----------------- script/{bootstrap => bootstrap.sh} | 2 +- 2 files changed, 25 insertions(+), 33 deletions(-) rename script/{bootstrap => bootstrap.sh} (63%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c2a1724..36f9a81 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,19 +6,18 @@ on: env: NODE_VERSION: 20 - CI: 1 jobs: setup: runs-on: ubuntu-latest name: Setup steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 id: node-setup with: node-version: ${{ env.NODE_VERSION }} - - uses: actions/cache@v3 + - uses: actions/cache@v4 id: cache-restore with: path: | @@ -26,19 +25,19 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} - name: Install dependencies if: steps.cache-restore.outputs.cache-hit != 'true' - run: . script/bootstrap + run: . script/bootstrap.sh lint: runs-on: ubuntu-latest name: Lint needs: setup steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 id: node-setup with: node-version: ${{ env.NODE_VERSION }} - name: Yarn cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: yarn-cache-restore with: path: | @@ -46,37 +45,30 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} - name: Lint run: | - . script/bootstrap + . script/bootstrap.sh yarn lint build-app: runs-on: ubuntu-latest name: Build App needs: setup steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 id: node-setup with: node-version: ${{ env.NODE_VERSION }} - name: Yarn cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: yarn-cache-restore with: path: | .yarn key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} - - name: Parcel cache - uses: actions/cache@v3 - id: parcel-cache-restore - with: - path: | - .parcel-cache - key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}-parcel - run: | - . script/bootstrap + . script/bootstrap.sh yarn build - name: Build Artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: build-artifacts path: dist @@ -86,21 +78,21 @@ jobs: if: ${{ github.ref != 'refs/heads/main' }} needs: build-app steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 id: node-setup with: node-version: ${{ env.NODE_VERSION }} - name: Yarn cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: yarn-cache-restore with: path: | .yarn key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} - - run: . script/bootstrap + - run: . script/bootstrap.sh - name: Build Artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: build-artifacts path: dist @@ -113,7 +105,7 @@ jobs: yarn netlify deploy --dir=dist --json | jq .deploy_url > output.log echo "::set-output name=draft-url::$(cat output.log)" - name: Report - uses: actions/github-script@v6 + uses: actions/github-script@v7 env: DRAFT_URL: ${{ steps.preview-deploy.outputs.draft-url }} with: @@ -131,21 +123,21 @@ jobs: needs: build-app if: ${{ github.ref == 'refs/heads/main' }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 id: node-setup with: node-version: ${{ env.NODE_VERSION }} - name: Yarn cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: yarn-cache-restore with: path: | .yarn key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} - - run: . script/bootstrap + - run: . script/bootstrap.sh - name: Build Artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: build-artifacts path: dist diff --git a/script/bootstrap b/script/bootstrap.sh similarity index 63% rename from script/bootstrap rename to script/bootstrap.sh index 106c07b..2114c5c 100644 --- a/script/bootstrap +++ b/script/bootstrap.sh @@ -1,6 +1,6 @@ #!/bin/bash -if [[ $CI != 1 ]]; then +if [[ -z "${CI+true}" ]]; then nvm use fi