aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/deploy.yml
diff options
context:
space:
mode:
authorBobby <[email protected]>2025-06-16 10:30:21 +0530
committerBobby <[email protected]>2025-06-16 10:30:21 +0530
commit36eaef1926fa73eebc55a39c6f9eff7000894261 (patch)
treeaecf2af710210225b84485022dd3fdc526b3cb91 /.github/workflows/deploy.yml
parent34c1bbb3955629da4ab4659d70195540b08156f4 (diff)
downloadimageboard-36eaef1926fa73eebc55a39c6f9eff7000894261.tar.xz
imageboard-36eaef1926fa73eebc55a39c6f9eff7000894261.zip
added build and deploy workflows
Diffstat (limited to '.github/workflows/deploy.yml')
-rw-r--r--.github/workflows/deploy.yml56
1 files changed, 56 insertions, 0 deletions
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 0000000..2c2abd3
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,56 @@
+name: Deploy
+
+on:
+ workflow_run:
+ workflows: ["Build"]
+ types:
+ - completed
+ branches: [main]
+
+jobs:
+ build_and_deploy:
+ runs-on: ubuntu-latest
+ if: ${{ github.event.workflow_run.conclusion == 'success' }}
+ env:
+ IMAGE_URL: ""
+ APP_SERVER: ${{ secrets.APP_SERVER }}
+ APP_NAME: ${{ secrets.APP_NAME }}
+ APP_TOKEN: ${{ secrets.APP_TOKEN }}
+
+ steps:
+ - name: Check out repository
+ uses: actions/checkout@v4
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Login to Container Registry
+ uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.repository_owner }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Preset Image Name
+ id: set_image_url
+ run: |
+ IMAGE_URL=$(echo ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:$(echo ${{ github.sha }} | cut -c1-7) | tr '[:upper:]' '[:lower:]')
+ echo "IMAGE_URL=$IMAGE_URL" >> $GITHUB_ENV
+ echo "image_url=$IMAGE_URL" >> $GITHUB_OUTPUT
+
+ - name: Build and push Docker Image
+ uses: docker/build-push-action@v5
+ with:
+ context: .
+ file: ./Dockerfile
+ push: true
+ platforms: linux/arm64/v8
+ tags: ${{ steps.set_image_url.outputs.image_url }}
+
+ - name: Deploy Image to Server
+ uses: caprover/[email protected]
+ with:
+ server: ${{ env.APP_SERVER }}
+ app: ${{ env.APP_NAME }}
+ token: ${{ env.APP_TOKEN }}
+ image: ${{ steps.set_image_url.outputs.image_url }} \ No newline at end of file