v4.0.2 #20
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: image build and push | |
on: | |
release: | |
types: [ published ] | |
jobs: | |
image_builder: | |
runs-on: ubuntu-22.04 | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
registry: ghcr.io | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64, linux/arm64 | |
push: true | |
tags: ghcr.io/inkomomutane/mimovel:latest | |
deploy_image_to_server: | |
needs: image_builder | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
- name: copy docker-compose file to server | |
uses: appleboy/scp-action@v1 | |
with: | |
host: ${{ secrets.PRODUCTION_SSH_REMOTE_HOSTNAME }} | |
username: ${{ secrets.SSH_DEPLOY_USENAME }} | |
key: ${{ secrets.SSH_DEPLOY_PRIVATE_KEY }} | |
source: "docker-compose.prod.yml" | |
target: mimovel | |
- name: initialize ssh and deploy | |
uses: fifsky/ssh-action@master | |
with: | |
command: | | |
cd ~/mimovel | |
docker image prune -f | |
# Pull the latest image | |
docker pull ghcr.io/inkomomutane/mimovel:latest | |
docker stack deploy -c docker-compose.prod.yml mimovel -d | |
# Optional: Clean up unused images | |
docker image prune -f | |
host: ${{ secrets.PRODUCTION_SSH_REMOTE_HOSTNAME }} | |
user: ${{ secrets.SSH_DEPLOY_USENAME }} | |
key: ${{ secrets.SSH_DEPLOY_PRIVATE_KEY }} | |
# pass: ${{ secrets.SSH_PASS_KEY }} | |
args: '-tt -vvv' |