Merge pull request #11 from AmphoraProtocol/bootstrap #26
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
name: Build, Test and Deploy | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
jobs: | |
build: | |
if: github.repository == 'AmphoraProtocol/app' | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ github.ref_name == 'main' && 'Prod' || 'Dev' }} | |
url: ${{ github.ref_name == 'main' && 'https://amphorafinance.com' || 'https://dev.amphorafinance.com' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" | |
registry-url: "https://registry.npmjs.org" | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install project dependencies | |
run: yarn --prefer-offline --network-concurrency 1 | |
id: install | |
- name: Run Prettier | |
run: yarn prettier | |
- name: Run Linter | |
run: yarn lint | |
- name: Build project dependencies | |
run: yarn run build | |
id: build | |
env: | |
VITE_CUSTOM_LOCAL_RPC: ${{ secrets.VITE_CUSTOM_LOCAL_RPC }} | |
VITE_ALLOW_DEV_MODE: ${{ secrets.VITE_ALLOW_DEV_MODE }} | |
VITE_ALCHEMY_KEY: ${{ secrets.VITE_ALCHEMY_KEY }} | |
VITE_WALLET_CONNECT_ID: ${{ secrets.VITE_WALLET_CONNECT_ID }} | |
- name: Deploy to S3 | |
uses: reggionick/s3-deploy@v3 | |
with: | |
folder: dist | |
bucket: ${{ secrets.S3_BUCKET_NAME }} | |
bucket-region: ${{ secrets.S3_BUCKET_REGION }} | |
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} | |
invalidation: / * | |
delete-removed: true | |
private: true | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |