Add workaround to fix Jobs on Mac OS X for Arm64. (#619) #407
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 workflow runs automatically on pushes to master that affect Internal API and its dependencies. | |
# It can also be run manually via workflow_dispatch. It uses check-if-branch-should-deploy | |
# to prevent cluttering the deployments list with initial release-hotfix- branches. | |
# | |
# It follows a build-then-deploy pattern: | |
# - Build: Compiles the Internal API project and upload as artifact | |
# - Deploy to Dev: Download artifact and deploy | |
# - Deploy to QA: Download artifact and deploy | |
# - Deploy to Production: Download artifact and deploy | |
# | |
# Note: Environment deployments require approval through GitHub environment protection rules | |
name: Post-merge (Internal API) | |
on: | |
push: | |
branches: | |
- master | |
- 'release-hotfix-*' | |
paths: | |
- 'Directory.Build.props' | |
- 'Directory.Packages.props' | |
- 'src/Aquifer.AI/**' | |
- 'src/Aquifer.API/**' | |
- 'src/Aquifer.Common/**' | |
- 'src/Aquifer.Data/**' | |
- 'src/Aquifer.JSEngine/**' | |
- 'src/Aquifer.Tiptap/**' | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: write | |
deployments: read | |
pull-requests: read | |
jobs: | |
check_should_deploy: | |
runs-on: ubuntu-latest | |
outputs: | |
should_deploy: ${{ github.event_name == 'workflow_dispatch' || steps.check_deploy.outputs.should_deploy == 'true' }} | |
steps: | |
- id: check_deploy | |
if: github.event_name != 'workflow_dispatch' | |
uses: BiblioNexusStudio/github-actions/check-if-branch-should-deploy@master | |
with: | |
current_branch: ${{ github.ref_name }} | |
build: | |
needs: | |
- check_should_deploy | |
if: needs.check_should_deploy.outputs.should_deploy == 'true' | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/[email protected] | |
- name: Setup .NET | |
uses: actions/[email protected] | |
with: | |
dotnet-version: '9.x' | |
- name: Install NuGet packages (linux) | |
run: dotnet restore --runtime linux-x64 | |
- name: Restore CLI tools | |
run: dotnet tool restore | |
- name: Make build directory | |
run: mkdir ./build | |
- name: Build API | |
run: dotnet publish src/Aquifer.API --output ./Aquifer.API --configuration Release --runtime win-x64 --self-contained | |
- name: Zip API | |
run: cd ./Aquifer.API && zip ../build/Build.zip * | |
- name: Bundle migrations | |
run: dotnet ef migrations bundle --startup-project src/Aquifer.Migrations --project src/Aquifer.Data --output build/Migrate --self-contained | |
- name: Publish artifact | |
uses: actions/[email protected] | |
with: | |
include-hidden-files: true | |
name: build | |
path: build | |
deploy_internal_api_to_dev: | |
if: needs.check_should_deploy.outputs.should_deploy == 'true' | |
name: Deploy Internal API to dev | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- check_should_deploy | |
environment: | |
name: dev-internal | |
url: ${{ vars.URL_DEV }} | |
steps: | |
- name: Checkout source code | |
uses: actions/[email protected] | |
- uses: ./.github/actions/deploy-to-env | |
id: deploy | |
with: | |
environment: dev | |
connection-url: ${{ vars.DB_CONNECTION_URL_DEV }} | |
web-app-name: ${{ vars.AZURE_WEB_APP_NAME_INTERNAL_DEV }} | |
resource-group: ${{ vars.AZURE_RESOURCE_GROUP_DEV }} | |
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
deploy_internal_api_to_qa: | |
if: needs.check_should_deploy.outputs.should_deploy == 'true' | |
name: Deploy Internal API to qa | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- check_should_deploy | |
environment: | |
name: qa-internal | |
url: ${{ vars.URL_QA }} | |
steps: | |
- name: Checkout source code | |
uses: actions/[email protected] | |
- uses: ./.github/actions/deploy-to-env | |
id: deploy | |
with: | |
environment: qa | |
full-environment: qa-internal | |
connection-url: ${{ vars.DB_CONNECTION_URL_QA }} | |
web-app-name: ${{ vars.AZURE_WEB_APP_NAME_INTERNAL_QA }} | |
resource-group: ${{ vars.AZURE_RESOURCE_GROUP_QA }} | |
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
linear-api-key: ${{ secrets.LINEAR_API_KEY }} | |
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} | |
service-name: Internal API | |
deploy_internal_api_to_prod: | |
if: needs.check_should_deploy.outputs.should_deploy == 'true' | |
name: Deploy Internal API to prod | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- check_should_deploy | |
environment: | |
name: prod-internal | |
url: ${{ vars.URL_PROD }} | |
steps: | |
- name: Checkout source code | |
uses: actions/[email protected] | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: ./.github/actions/deploy-to-env | |
id: deploy | |
with: | |
environment: prod | |
full-environment: prod-internal | |
connection-url: ${{ vars.DB_CONNECTION_URL_PROD }} | |
web-app-name: ${{ vars.AZURE_WEB_APP_NAME_INTERNAL_PROD }} | |
resource-group: ${{ vars.AZURE_RESOURCE_GROUP_PROD }} | |
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
linear-api-key: ${{ secrets.LINEAR_API_KEY }} | |
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} | |
service-name: Internal API | |
- uses: BiblioNexusStudio/github-actions/delete-hotfix-branch@master | |
with: | |
current_branch: ${{ github.ref_name }} | |
app_id: ${{ secrets.BIBLIONEXUS_BOT_APP_ID }} | |
private_key: ${{ secrets.BIBLIONEXUS_BOT_PRIVATE_KEY }} |