Skip to content

Deploy

Deploy #51

Workflow file for this run

name: Deploy static site
on:
push:
branches:
- main
- deploy
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
build-deploy-static-site:
runs-on: ubuntu-latest
name: Build and deploy static site
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: gradle jsBrowserProductionLibraryDistribution
working-directory: webtool/gradle/common
run: gradle jsBrowserProductionLibraryDistribution
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
env:
VITE_BACKEND_URL: https://local4local-backend.zenmo.com
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_DEPLOY_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/webtool/frontend" # App source code path
api_location: "" # Api source code path - optional
output_location: "dist" # Built app content directory - optional
###### End of Repository/Build Configurations ######
deploy-backend:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@main
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ghcr.io/zenmo/local4local-backend:${{ github.run_number }}
context: ./webtool/gradle
- name: Deploy to swarm
uses: sagebind/docker-swarm-deploy-action@v2
env:
GITHUB_RUN_NUMBER: ${{ github.run_number }}
with:
remote_host: ssh://[email protected]
ssh_private_key: ${{ secrets.SWARM_SSH_PRIVATE_KEY }}
ssh_public_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ1E4LUG22qgzc8U7oNYGWCn0cyA31+iyX2pck9wcPMS
args: stack deploy --compose-file ./webtool/compose-prod.yaml local4local