Merge pull request #415 from OpenElements/dependabot/npm_and_yarn/fro… #374
This file contains hidden or 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 main to Azure | |
env: | |
AZURE_WEBAPP_NAME: benchscape | |
AZURE_PUBLISH_PROFILE: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_BENCHSCAPE_MAIN }} | |
AZURE_FRONTEND_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BENCHSCAPE_MAIN }} | |
JAVA_VERSION: "17" | |
DISTRIBUTION: temurin | |
FRONTEND_LOCATION: "frontend/build" | |
SERVER_LOCATION: "${{ github.workspace }}/server/target/benchscape-server.jar" | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build and Deploy | |
env: | |
HUSKY: 0 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Java version | |
uses: actions/setup-java@v3.0.0 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.DISTRIBUTION }} | |
cache: "maven" | |
- name: Set up npm cache | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: "npm" | |
cache-dependency-path: "**/package-lock.json" | |
- name: Build with Maven | |
run: mvn verify | |
- name: Upload Frontend to Azure | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
azure_static_web_apps_api_token: ${{ env.AZURE_FRONTEND_TOKEN }} | |
action: "upload" | |
skip_app_build: true | |
app_location: ${{ env.FRONTEND_LOCATION }} | |
- name: Upload Server to Azure | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
publish-profile: ${{ env.AZURE_PUBLISH_PROFILE }} | |
package: ${{ env.SERVER_LOCATION }} |