diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 59ee75b..515c6da 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,8 @@ name: Deploy on release on: - push: - branches: - -master - -releases + release: + types: [published] jobs: unit-tests: @@ -41,8 +39,6 @@ jobs: - run: npm --prefix webapp install - run: npm --prefix webapp run build - run: npm --prefix webapp run test:e2e - - docker-push-webapp: name: Push webapp Docker Image to GitHub Packages runs-on: ubuntu-latest @@ -55,17 +51,34 @@ jobs: - name: Publish to Registry uses: elgohr/Publish-Docker-Github-Action@v5 env: - API_URI: http://${{ secrets.DEPLOY_HOST || 'localhost' }}:8000 - - + API_URI: http://${{ secrets.DEPLOY_HOST }}:8000 with: name: arquisoft/wiq_es04c/webapp username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io workdir: webapp - buildargs: API_URI=${{ env.API_URI }} - + buildargs: API_URI + docker-push-questionservice: + name: Push question service Docker Image to GitHub Packages + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + needs: [e2e-tests] + steps: + - uses: actions/checkout@v4 + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@v5 + with: + name: arquisoft/wiq_es04c/questionservice + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + workdir: ./questionservice + + + docker-push-authservice: name: Push auth service Docker Image to GitHub Packages runs-on: ubuntu-latest @@ -116,30 +129,11 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io - workdir: ./gatewayservice - - docker-push-questionservice: - name: Push question service Docker Image to GitHub Packages - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - needs: [e2e-tests] - steps: - - uses: actions/checkout@v4 - - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@v5 - with: - name: arquisoft/wiq_es04c/questionservice - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - registry: ghcr.io - workdir: ./questionservice - + workdir: gatewayservice deploy: name: Deploy over SSH runs-on: ubuntu-latest - needs: [docker-push-userservice,docker-push-authservice,docker-push-gatewayservice,docker-push-webapp,docker-push-questionservice] + needs: [docker-push-userservice,docker-push-authservice,docker-push-gatewayservice,docker-push-webapp] steps: - name: Deploy over SSH uses: fifsky/ssh-action@master @@ -148,8 +142,7 @@ jobs: user: ${{ secrets.DEPLOY_USER }} key: ${{ secrets.DEPLOY_KEY }} command: | - wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/releases/docker-compose.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/releases/.env -O .env - git clone -b releases https://github.com/Arquisoft/wiq_es04c.git + wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/master/docker-compose.yml -O docker-compose.yml + wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/master/.env -O .env docker compose --profile prod down docker compose --profile prod up -d \ No newline at end of file