Skip to content

Commit

Permalink
Update prod CD
Browse files Browse the repository at this point in the history
  • Loading branch information
shu8 committed Jun 23, 2023
1 parent 67b4888 commit c10cf3e
Showing 1 changed file with 49 additions and 24 deletions.
73 changes: 49 additions & 24 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,32 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: '14'
node-version: '18'

- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install frontend dependencies
run: |
cp ./backend/uclapi/webpack-stats.sample.json ./backend/uclapi/static/webpack-stats.json && \
cd ./frontend/ && \
npm ci
cd ./uclapi-frontend && pnpm install --frozen-lockfile
- name: Build frontend
env:
Expand All @@ -35,14 +54,7 @@ jobs:
SENTRY_DSN_REACT: ${{ secrets.SENTRY_DSN_REACT }}
SENTRY_DSN_ENV: production
run: |
cd ./frontend && \
npm run build
- name: Upload frontend
uses: actions/upload-artifact@master
with:
name: frontend-build
path: ./backend/uclapi/static
cd ./uclapi-frontend && pnpm build
test-backend:
name: Run backend tests
Expand Down Expand Up @@ -123,18 +135,36 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: '14'
node-version: '18'

- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install frontend dependencies
run: |
cp ./backend/uclapi/webpack-stats.sample.json ./backend/uclapi/static/webpack-stats.json && \
cd ./frontend/ && \
npm ci
cd ./uclapi-frontend/ && pnpm install --frozen-lockfile
- name: Run frontend tests
run: |
cd ./frontend && \
npm test
cd ./uclapi-frontend && pnpm test
collect-statics:
name: Collect statics
Expand Down Expand Up @@ -167,12 +197,6 @@ jobs:
cd ./backend/uclapi && \
pip install -r requirements.txt
- name: Download frontend
uses: actions/download-artifact@v2
with:
name: frontend-build
path: ./backend/uclapi/static

- name: Collect statics to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -228,6 +252,7 @@ jobs:
unzip -qq compressed.zip && \
rm compressed.zip && \
echo "UCLAPI_VERSION=$UCLAPI_VERSION" >> uclapi/uclapi.env
echo "UCLAPI_VERSION=$UCLAPI_VERSION" >> uclapi/uclapi-web.env
- name: Build containers
env:
Expand Down

0 comments on commit c10cf3e

Please sign in to comment.