Merge branch 'develop' of github.com:Unipisa/dm-manager into develop #551
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: Docker Image CI | |
on: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: install node packages | |
run: npm ci | |
- name: Build Js bundle | |
run: REACT_APP_SERVER_URL="" npm run build | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: '6.0' | |
- name: Run tests | |
run: REACT_APP_SERVER_URL="" npm test | |
- name: Extract version number | |
run: echo VERSION=$( node -e 'console.log(require("./package.json").version)' ) >> $GITHUB_ENV | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: harbor.cs.dm.unipi.it/dm-manager/dm-manager | |
tags: | | |
type=ref,event=tag | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
- name: Login to docker Harbor | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.HARBOR_ROBOT_USERNAME }} | |
password: ${{ secrets.HARBOR_ROBOT }} | |
registry: harbor.cs.dm.unipi.it | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
push: true | |
context: . | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Trigger update on Watchtower | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
curl -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" https://watchtower.delta.cs.dm.unipi.it/v1/update | |