Battery costs (#107) #134
This file contains 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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
# 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 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
cache: npm | |
cache-dependency-path: ./webtool/frontend/package-lock.json | |
- run: npm install | |
working-directory: ./webtool/frontend | |
- run: npm run build | |
working-directory: ./webtool/frontend | |
env: | |
VITE_BACKEND_URL: https://local4local-backend.zenmo.com | |
VITE_ANYLOGIC_CALLBACK_URL: https://local4local-backend.zenmo.com | |
- name: Build And Deploy | |
id: builddeploy | |
uses: Azure/static-web-apps-deploy@v1 | |
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 | |
# We build in previous steps, because a build failure at this step doesn't block the deploy. | |
skip_app_build: true | |
app_location: "/webtool/frontend/dist" | |
api_location: "" # Api source code path - 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 |