-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from varianter/chore/gh/prod-actions
add config to gh action
- Loading branch information
Showing
6 changed files
with
106 additions
and
115 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: .NET Core CI | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
AZURE_WEBAPP_NAME: vibes-backend-prod # set this to your application's name | ||
AZURE_WEBAPP_PACKAGE_PATH: './backend' # set this to the path to your web app project, defaults to the repository root | ||
DOTNET_VERSION: '7.x.x' # set this to the dot net version to use | ||
|
||
jobs: | ||
build-backend-and-deploy: | ||
runs-on: ubuntu-latest | ||
environment: Production | ||
|
||
steps: | ||
# Checkout the repo | ||
- uses: actions/checkout@main | ||
|
||
# Setup .NET Core SDK | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
||
# Run dotnet build and publish | ||
- name: dotnet build and publish | ||
working-directory: backend/ | ||
run: | | ||
dotnet restore | ||
dotnet build --configuration Release | ||
dotnet publish -c Release --property:PublishDir='${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/build' | ||
# Deploy to Azure Web apps | ||
- name: 'Run Azure webapp deploy action using publish profile credentials' | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name | ||
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_BACKEND }} # Define secret variable in repository settings as per action documentation | ||
package: 'backend/${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/build' |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy | ||
# More GitHub Actions for Azure: https://github.com/Azure/actions | ||
|
||
# Primary ref: https://dev.to/ckgrafico/deploying-nextjs-to-azure-web-app-with-github-actions-1o9c | ||
|
||
name: Next.js deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
environment: Production | ||
|
||
defaults: | ||
run: | ||
working-directory: frontend | ||
|
||
steps: | ||
- name: 'Checkout' | ||
uses: actions/checkout@v3 | ||
|
||
- name: 'Setup Node.js version' | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18.x" | ||
|
||
- name: 'Restore cache' | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
frontend/.next/cache | ||
# Generate a new cache whenever packages or source files change. | ||
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | ||
# If source files changed but packages didn't, rebuild from a prior cache. | ||
restore-keys: | | ||
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}- | ||
- name: 'Install ci dependencies' | ||
run: yarn --frozen-lockfile --ignore-scripts | ||
|
||
- name: 'Build with Next.js' | ||
run: | | ||
yarn build | ||
mv ./build/static ./build/standalone/build | ||
mv ./public ./build/standalone | ||
env: | ||
NEXT_PUBLIC_VIBES_BACKEND_URL: ${{ vars.NEXT_PUBLIC_VIBES_BACKEND_URL }} | ||
NEXT_PUBLIC_CLIENT_ID: ${{ vars.NEXT_PUBLIC_CLIENT_ID }} | ||
NEXT_PUBLIC_TENANT_ID: ${{ vars.NEXT_PUBLIC_TENANT_ID }} | ||
NEXT_PUBLIC_APP_SCOPE: ${{ vars.NEXT_PUBLIC_APP_SCOPE }} | ||
|
||
|
||
- name: 'Deploy to Azure Web App (standalone)' | ||
id: deploy-to-webapp | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
app-name: 'vibes-frontend-prod' | ||
slot-name: 'Production' | ||
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_FRONTEND }} | ||
package: ./frontend/build/standalone |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.