PruebaDespliegueSprint1_v1.11 #17
Workflow file for this run
This file contains hidden or 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: Release — Build & Deploy | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| IMAGE_TAG: ${{ github.event.release.tag_name }} | |
| jobs: | |
| # Publicar imagen users | |
| docker-push-users: | |
| name: Publish users image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Publish users image | |
| uses: elgohr/Publish-Docker-Github-Action@v5 | |
| with: | |
| name: ${{ github.repository_owner }}/${{ github.event.repository.name }}-users | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| registry: ghcr.io | |
| workdir: users | |
| # Publicar imagen webapp | |
| docker-push-webapp: | |
| name: Publish webapp image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Publish webapp image | |
| uses: elgohr/Publish-Docker-Github-Action@v5 | |
| with: | |
| name: ${{ github.repository_owner }}/${{ github.event.repository.name }}-webapp | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| registry: ghcr.io | |
| workdir: webapp | |
| buildargs: VITE_API_URL=http://gateway:8000 | |
| # Publicar imagen gamey | |
| docker-push-gamey: | |
| name: Publish gamey image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Publish gamey image | |
| uses: elgohr/Publish-Docker-Github-Action@v5 | |
| with: | |
| name: ${{ github.repository_owner }}/${{ github.event.repository.name }}-gamey | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| registry: ghcr.io | |
| workdir: gamey | |
| # Publicar imagen game | |
| docker-push-game: | |
| name: Publish game image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Publish game image | |
| uses: elgohr/Publish-Docker-Github-Action@v5 | |
| with: | |
| name: ${{ github.repository_owner }}/${{ github.event.repository.name }}-game | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| registry: ghcr.io | |
| workdir: game | |
| # Publicar imagen gateway | |
| docker-push-gateway: | |
| name: Publish gateway image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Publish gateway image | |
| uses: elgohr/Publish-Docker-Github-Action@v5 | |
| with: | |
| name: ${{ github.repository_owner }}/${{ github.event.repository.name }}-gateway | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| registry: ghcr.io | |
| workdir: gateway | |
| # Deploy sobre el servidor | |
| deploy: | |
| name: Deploy over SSH | |
| runs-on: ubuntu-latest | |
| needs: [docker-push-users, docker-push-webapp, docker-push-gamey, docker-push-game, docker-push-gateway] | |
| steps: | |
| - name: Deploy over SSH | |
| uses: fifsky/ssh-action@master | |
| with: | |
| host: ${{ secrets.DEPLOY_HOST }} | |
| user: ${{ secrets.DEPLOY_USER }} | |
| key: ${{ secrets.DEPLOY_KEY }} | |
| command: | | |
| wget https://raw.githubusercontent.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/${{ github.event.release.tag_name }}/docker-compose.yml -O docker-compose.yml | |
| docker compose down | |
| docker compose up -d --pull always |