Skip to content

Commit

Permalink
new github action for caps:api
Browse files Browse the repository at this point in the history
  • Loading branch information
paolini committed Jan 3, 2024
1 parent 42d0200 commit a304ad7
Showing 1 changed file with 14 additions and 27 deletions.
41 changes: 14 additions & 27 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: tests
name: build docker image

on: push

Expand All @@ -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
Expand Down

0 comments on commit a304ad7

Please sign in to comment.