From 8583a8b388df99750daf7b11e2fab80fc64a911a Mon Sep 17 00:00:00 2001 From: Jose Henrique Date: Fri, 10 Jul 2026 18:11:28 -0300 Subject: [PATCH] new pipeline --- .gitea/workflows/deploy.yaml | 51 ++++++++++++++++++++++++++++++++++++ .gitea/workflows/main.yaml | 14 ++++++++-- 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 .gitea/workflows/deploy.yaml diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..4d0aa09 --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,51 @@ +name: Homepage Deploy (Production) + +on: + workflow_dispatch: {} + +env: + REGISTRY_HOST: git.ivanch.me + REGISTRY_USERNAME: ivanch + IMAGE_NAME: ${{ env.REGISTRY_HOST }}/ivanch/mainpage + +jobs: + build: + name: Build Homepage Image + runs-on: ubuntu-amd64 + outputs: + short_sha: ${{ steps.vars.outputs.short_sha }} + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Export short commit SHA + id: vars + shell: bash + run: echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" + + - name: Build and Push Multi-Arch Image + uses: https://git.ivanch.me/ivanch/pipeline-actions/build-and-push@main + with: + image: ${{ env.IMAGE_NAME }} + image_tag: latest + registry_password: ${{ secrets.REGISTRY_PASSWORD }} + ssh_key: ${{ secrets.SSH_KEY_DOCKERBUILD }} + + deploy: + name: Deploy Homepage + runs-on: ubuntu-amd64 + needs: build + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Recreate Container + uses: https://git.ivanch.me/ivanch/pipeline-actions/ssh-deploy@main + with: + ssh_host: ${{ secrets.HOST }} + ssh_username: ${{ secrets.USERNAME }} + ssh_key: ${{ secrets.KEY }} + ssh_port: ${{ secrets.PORT }} + remote_dir: ${{ secrets.DIR }} + image: ${{ env.IMAGE_NAME }} + image_tag: latest diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main.yaml index d6307e3..df59f79 100644 --- a/.gitea/workflows/main.yaml +++ b/.gitea/workflows/main.yaml @@ -1,4 +1,4 @@ -name: Homepage Build and Deploy +name: Homepage Build and Deploy (Test) on: push: @@ -15,14 +15,22 @@ jobs: build: name: Build Homepage Image runs-on: ubuntu-amd64 + outputs: + short_sha: ${{ steps.vars.outputs.short_sha }} steps: - name: Check out repository uses: actions/checkout@v4 + - name: Export short commit SHA + id: vars + shell: bash + run: echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" + - name: Build and Push Multi-Arch Image uses: https://git.ivanch.me/ivanch/pipeline-actions/build-and-push@main with: image: ${{ env.IMAGE_NAME }} + image_tag: ${{ steps.vars.outputs.short_sha }} registry_password: ${{ secrets.REGISTRY_PASSWORD }} ssh_key: ${{ secrets.SSH_KEY_DOCKERBUILD }} @@ -41,4 +49,6 @@ jobs: ssh_username: ${{ secrets.USERNAME }} ssh_key: ${{ secrets.KEY }} ssh_port: ${{ secrets.PORT }} - remote_dir: ${{ secrets.DIR }} + remote_dir: ${{ secrets.TEST_DIR }} + image: ${{ env.IMAGE_NAME }} + image_tag: ${{ needs.build.outputs.short_sha }}