Created
October 23, 2022 08:48
-
-
Save m-jovanovic/d69d082c5445947c10079ee372a4377c to your computer and use it in GitHub Desktop.
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: Publish Development π | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
env: | |
AZURE_WEBAPP_NAME: dev-api-trainersphere | |
AZURE_WEBAPP_PACKAGE_PATH: "./publish" | |
DOTNET_VERSION: "6.0.x" | |
CONNECTIONSTRINGS__DATABASE: "<Replaced by Bundle>" | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET Core π¦ | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Install dependencies π | |
run: dotnet restore ./src/App | |
- name: Build π§± | |
run: dotnet build ./src/App --configuration Release --no-restore | |
- name: Test π§ͺ | |
run: dotnet test ./src/App --configuration Release --no-build --verbosity normal | |
- name: Install EF Tool π¦ | |
run: | | |
dotnet new tool-manifest | |
dotnet tool install dotnet-ef --version 6.0.3 | |
- name: Create migration bundles π¦ | |
run: | | |
dotnet ef migrations bundle --configuration Bundle --verbose --startup-project ./src/App --project ./src/Modules/Users/Modules.Users.Persistence --context UsersDbContext --output users-bundle.exe | |
dotnet ef migrations bundle --configuration Bundle --verbose --startup-project ./src/App --project ./src/Modules/Training/Modules.Training.Persistence --context TrainingDbContext --output training-bundle.exe | |
dotnet ef migrations bundle --configuration Bundle --verbose --startup-project ./src/App --project ./src/Modules/Notifications/Modules.Notifications.Persistence --context NotificationsDbContext --output notifications-bundle.exe | |
- name: Apply migration bundles π© | |
run: | | |
./users-bundle.exe --connection '${{ secrets.DEV_CONNECTION_STRING }}' --verbose | |
./training-bundle.exe --connection '${{ secrets.DEV_CONNECTION_STRING }}' --verbose | |
./notifications-bundle.exe --connection '${{ secrets.DEV_CONNECTION_STRING }}' --verbose | |
- name: Publish π | |
run: dotnet publish ./src/App --configuration Release --no-build --output '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}' | |
- name: Deploy to Azure π | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
publish-profile: ${{ secrets.DEV_AZURE_PUBLISH_PROFILE }} | |
package: "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice code helped me a lot in my packages.
Thank from
rosas breakfast time team