Merge pull request #12 from CAU-MOAPP-2023/feat/11-feat-user-crud #9
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: Node.js CI | |
on: | |
push: | |
branches: [ "main", "develop" ] | |
jobs: | |
CI: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: 18.x | |
- name: Install modules & Build | |
run: | | |
npm ci | |
npm run build --if-present | |
- name: Run test | |
run: | | |
npm test | |
npm run test:e2e | |
- name: Docker login | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
logout: true | |
- name: Build and push to DockerHub | |
run: | | |
docker build -t ${{ secrets.PROJECT_NAME }} . | |
docker tag ${{ secrets.PROJECT_NAME }}:latest ${{ secrets.DOCKER_USERNAME }}/${{ secrets.PROJECT_NAME }}:latest | |
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.PROJECT_NAME }}:latest |