From 34cfc5b1bf87e38c451d0ea5e7e21389748e4c9d Mon Sep 17 00:00:00 2001 From: aleidk Date: Mon, 9 Dec 2024 10:49:01 -0300 Subject: [PATCH] build: add autodeploy workflow --- .forgejo/workflows/build-docker-image.yaml | 19 +++++++++++++++++++ content/_index.md | 2 +- docker-stack.yaml | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/build-docker-image.yaml b/.forgejo/workflows/build-docker-image.yaml index ee1c684..52e6541 100644 --- a/.forgejo/workflows/build-docker-image.yaml +++ b/.forgejo/workflows/build-docker-image.yaml @@ -1,6 +1,8 @@ name: Publish image on: push: + branches: + - main workflow_dispatch: jobs: @@ -25,3 +27,20 @@ jobs: tags: | git.alecodes.page/alecodes/page:latest git.alecodes.page/alecodes/page:${{ github.sha }} + + deploy: + runs-on: ubuntu-latest + needs: + - create-docker-images + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: 'Docker Stack Deploy' + uses: https://github.com/cssnr/stack-deploy-action@v1 + with: + host: ${{ vars.DOCKER_SWARM_HOST }} + port: ${{ vars.DOCKER_SWARM_PORT }} + user: ${{ secrets.DOCKER_SWARM_USER }} + ssh_key: '${{ secrets.DOCKER_SWARM_SSH_KEY }}' + file: 'docker-stack.yaml' + name: 'personal-page' diff --git a/content/_index.md b/content/_index.md index 488c699..2f11bb4 100644 --- a/content/_index.md +++ b/content/_index.md @@ -2,4 +2,4 @@ +++ -# This is a awesome page :D +# This is a **really** awesome page :D diff --git a/docker-stack.yaml b/docker-stack.yaml index 2f80b38..5a01827 100644 --- a/docker-stack.yaml +++ b/docker-stack.yaml @@ -4,7 +4,7 @@ networks: services: page: - image: git.alecodes.page/alecodes/page:latest + image: git.alecodes.page/alecodes/page:${GITHUB_SHA:latest} restart: unless-stopped networks: - reverse-proxy