-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
46 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,12 +18,19 @@ jobs: | |
black: false | ||
ruff: true | ||
|
||
frontend-check: | ||
name: "Frontend Check" | ||
uses: pennlabs/shared-actions/.github/workflows/react-check[email protected] | ||
frontend-check-and-publish: | ||
name: "Frontend Check and Publish" | ||
uses: pennlabs/shared-actions/.github/workflows/[email protected].3 | ||
with: | ||
imageName: penn-clubs-frontend | ||
githubRef: ${{ github.ref }} | ||
gitSha: ${{ github.sha }} | ||
path: frontend | ||
nodeVersion: 20.11.1 | ||
dockerfile: frontend/Dockerfile | ||
secrets: | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
build-backend: | ||
name: Build backend | ||
|
@@ -53,61 +60,26 @@ jobs: | |
path: /tmp/image.tar | ||
needs: backend-check | ||
|
||
build-frontend: | ||
name: Build frontend | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: docker/setup-qemu-action@v1 | ||
- uses: docker/setup-buildx-action@v1 | ||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: buildx-build-frontend | ||
- name: Build/Publish | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: frontend | ||
file: frontend/Dockerfile | ||
push: false | ||
cache-from: type=local,src=/tmp/.buildx-cache,type=registry,ref=pennlabs/penn-clubs-frontend:latest | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
tags: pennlabs/penn-clubs-frontend:latest,pennlabs/penn-clubs-frontend:${{ github.sha }} | ||
outputs: type=docker,dest=/tmp/image.tar | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-frontend | ||
path: /tmp/image.tar | ||
needs: frontend-check | ||
|
||
publish: | ||
name: Publish Images | ||
publish-backend: | ||
name: Publish Backend Image | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/master' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/download-artifact@v4 | ||
- uses: geekyeggo/delete-artifact@v5 | ||
with: | ||
name: |- | ||
build-backend | ||
build-frontend | ||
- name: Load docker images | ||
run: |- | ||
docker load --input build-backend/image.tar | ||
docker load --input build-frontend/image.tar | ||
name: build-backend | ||
- name: Load docker image | ||
run: docker load --input build-backend/image.tar | ||
- uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Push docker images | ||
run: |- | ||
docker push -a pennlabs/penn-clubs-backend | ||
docker push -a pennlabs/penn-clubs-frontend | ||
- name: Push docker image | ||
run: docker push -a pennlabs/penn-clubs-backend | ||
needs: | ||
- build-backend | ||
- build-frontend | ||
|
||
deploy: | ||
name: "Deploy" | ||
|
@@ -123,4 +95,5 @@ jobs: | |
GH_AWS_SECRET_ACCESS_KEY: ${{ secrets.GH_AWS_SECRET_ACCESS_KEY }} | ||
|
||
needs: | ||
- publish | ||
- frontend-check-and-publish | ||
- publish-backend |