Add Reef check surveys #658
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for comment on PR, follow instruction for: https://github.com/marketplace/actions/sticky-pull-request-comment | |
name: Aqualink Website CI | |
on: | |
# Run on all pull requests and on pushes to main. | |
pull_request: | |
paths: | |
- 'packages/website/**' | |
push: | |
branches: | |
- master | |
jobs: | |
website_test_build_and_deploy: | |
runs-on: ubuntu-22.04 | |
env: | |
REACT_APP_MAPBOX_ACCESS_TOKEN: ${{ secrets.REACT_APP_MAPBOX_ACCESS_TOKEN }} | |
REACT_APP_SOFAR_API_TOKEN: ${{ secrets.REACT_APP_SOFAR_API_TOKEN }} | |
REACT_APP_FIREBASE_API_KEY: ${{ secrets.REACT_APP_FIREBASE_API_KEY }} | |
surge_url: aqualink-app-${{ github.event.pull_request.number }}.surge.sh | |
REACT_APP_API_BASE_URL: ${{ vars.REACT_APP_API_BASE_URL }} | |
REACT_APP_FEATURED_SITE_ID: ${{ vars.REACT_APP_FEATURED_SITE_ID }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies if needed. | |
id: install | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: | | |
yarn install --ignore-engines --frozen-lockfile | |
- name: Run website lint | |
if: success() || steps.install.conclusion == 'skipped' | |
working-directory: packages/website | |
run: yarn lint | |
- name: Run website tests | |
if: success() || steps.install.conclusion == 'skipped' || steps.install.conclusion == 'success' | |
working-directory: packages/website | |
run: yarn test | |
- name: Build website | |
id: build_website | |
if: success() || steps.install.conclusion == 'skipped' || steps.install.conclusion == 'success' | |
working-directory: packages/website | |
run: yarn build | |
- name: Deploy pull request on surge | |
if: steps.build_website.outcome == 'success' && github.event.pull_request.number != null | |
uses: dswistowski/surge-sh-action@v1 | |
with: | |
domain: ${{ env.surge_url }} | |
project: "packages/website/build/." | |
login: ${{ secrets.surge_login }} | |
token: ${{ secrets.surge_token }} | |
- name: Get current date | |
id: date | |
run: echo "date=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT | |
- name: Comment PR | |
uses: marocchino/sticky-pull-request-comment@v1 | |
continue-on-error: true | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
message: | | |
Build succeeded and deployed at https://${{ env.surge_url }} | |
(hash ${{ github.event.pull_request.head.sha }} deployed at ${{ steps.date.outputs.date }}) |