new github action for caps:api #839
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: build docker image | |
on: push | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: build client webpack | |
run: | | |
cd frontend/ | |
npm ci | |
npm run js | |
- name: prepare server | |
run: | | |
cd api/ | |
npm ci | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Docker meta | |
id: meta | |
uses: crazy-max/ghaction-docker-meta@v2 | |
with: | |
images: harbor.cs.dm.unipi.it/caps/caps | |
tags: api | |
- name: Login to harbor | |
uses: docker/login-action@v3 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
registry: harbor.cs.dm.unipi.it | |
username: ${{ secrets.HARBOR_CAPS_ROBOT }} | |
password: ${{ secrets.HARBOR_CAPS_SECRET }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
push: true | |
cache-from: type=registry,ref=harbor.cs.dm.unipi.it/caps/caps:api | |
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_CAPS_SECRET }}" https://watchtower.caps.dm.unipi.it/v1/update | |
curl -H "Authorization: Bearer ${{ secrets.WATCHTOWER_SECRET }}" https://watchtower.pi.cs.dm.unipi.it/v1/update |