Bump ejs and @vue/cli-service in /code/frontend #94
This file contains hidden or 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
# Action name | |
name: Npm, Java CI and deploy to docker | |
# When will the action run | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
# build the project | |
build-frontend: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./code/frontend | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up npm | |
uses: actions/setup-node@v4 | |
- run: npm install | |
- run: npm run build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: frontend | |
path: ./code/frontend/dist/ | |
# build the project | |
build-backend: | |
needs: [build-frontend] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./code/backend | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: download frontend | |
uses: actions/download-artifact@v4 | |
with: | |
name: frontend | |
path: ./code/backend/src/main/resources/static/ | |
- name: Build with Maven | |
run: mvn clean package --file pom.xml -DskipTests | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bu-secondhand-1.0.0 | |
path: ./code/backend/target/ | |
# build a docker image and push it to Docker Hub | |
deploy: | |
needs: [build-backend] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: bu-secondhand-1.0.0 | |
path: ./code/backend/target/ | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and Push docker | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./code/backend | |
file: ./code/backend/Dockerfile | |
push: true | |
tags: ${{ vars.DOCKERHUB_USERNAME }}/campus_exchange:latest |