diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3502ee60..42dfc4ee 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,4 +1,4 @@ -name: tests +name: build docker image on: push @@ -7,50 +7,37 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: JS tests + - name: build client webpack run: | cd frontend/ npm ci - npm run test - npm run deploy - npm run deploy:dev - - name: PHP tests + npm run js + - name: prepare server run: | - cd backend/ - php7.4 -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php7.4 composer-setup.php - php7.4 -r "unlink('composer-setup.php');" - sudo apt-get -y install php-mbstring php-intl php-xml php-sqlite3 php-mysql php-zip php-ldap php-gd - php7.4 composer.phar -n install - bin/cake migrations migrate - php7.4 vendor/bin/phpunit --debug - - name: Pull previous Docker image - run: | - docker pull getcaps/caps:develop + 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: getcaps/caps - tags: | - type=ref,event=tag - type=ref,event=branch - type=semver,pattern={{version}} - - name: Login to DockerHub - uses: docker/login-action@v1 + 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: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + 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=getcaps/caps:develop + 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