Skip to content

Bump ejs and @vue/cli-service in /code/frontend #94

Bump ejs and @vue/cli-service in /code/frontend

Bump ejs and @vue/cli-service in /code/frontend #94

Workflow file for this run

# 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