Skip to content

Commit

Permalink
Extended VariableSubstitution custom GitHub action to substitute flat…
Browse files Browse the repository at this point in the history
… files like .env.deploy. CLoses #67
  • Loading branch information
jezzsantos committed Jan 8, 2025
1 parent 35aeee6 commit bfda1e3
Show file tree
Hide file tree
Showing 30 changed files with 1,415 additions and 825 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/deploy-azure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,15 @@ jobs:
npm run build
- name: Build (Backend) for Deploy
run: dotnet build --configuration ${{env.DEPLOY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" /p:HostingPlatform=${{env.HOSTED_ON}}
- name: Substitute GitHub Secrets/Variables
uses: ./src/Tools.GitHubActions/VariableSubstitution
with:
files: 'src/WebsiteHost/**/.env.deploy'
variables: ${{ toJSON(vars)}}
secrets: ${{ toJSON(secrets)}}
- name: Build WebsiteHost (FrontEnd) for Deploy
run: |
cd src/WebsiteHost/ClientApp
cp .env.example .env
npm ci --cache .npm --prefer-offline
npm run build:releasefordeploy
- name: Substitute GitHub Secrets/Variables
Expand Down
8 changes: 0 additions & 8 deletions README_DERIVATIVE.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,6 @@ In the `Infrastructure.Shared.IntegrationTests` project, create a new file calle

> Note: As a result of this build step you should see new bundle file (e.g. `0123456789abcdef.bundle.js`) appear in the `wwwroot` folder. This file should never be added to source control.
### Environment Variables

You need to create your own version of the `.env` file on your computer (not source controlled).

1. Copy the `src/WebsiteHost/ClientApp/.env.example` to `src/WebsiteHost/ClientApp/.env`.

> DO NOT add this file `.env` to source control! This files exists locally for security purposes, and in order to have the right environment variables in place when running and testing the JS App.
# Build & Deploy

When pushed, all branches will be built and tested with GitHub actions
Expand Down
11 changes: 2 additions & 9 deletions docs/DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ For example, when using the `deploy-azure.yml` file, you will need to define log
You can read about this process and the credentials required to do it in the [Azure Login Action](https://learn.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=openid%2Caspnetcore).

For deploying to Azure, (using the `deploy-azure.yml` deployment workflow) you will also need to define the following secrets and variables in your GitHub deployment environment:
* `DEPLOY_AZURE_CLIENT_ID`
* `DEPLOY_AZURE_TENANT_ID`
* `DEPLOY_AZURE_SUBSCRIPTION_ID`
* `DEPLOY_AZURE_CREDENTIALS`

> These are used to automate the deployment to your Azure subscription.
Expand Down Expand Up @@ -240,13 +238,8 @@ Now, you will copy and paste that whole output text into a GitHub secret called:

Now that your Azure environment is provisioned, you need to update the following variables and secrets in your GitHub Project.

Assign these GitHub variables (or secrets) in your deployment environment:
Assign these GitHub variables (or secrets) in your deployment environment, depending on the technology adapters you are using :

* `DEPLOY_AZURE_CLIENT_ID`
* `DEPLOY_AZURE_TENANT_ID`
* `DEPLOY_AZURE_SUBSCRIPTION_ID`

and these ones, depending on the technology adapters you are using :
* `APPLICATIONINSIGHTS_CONNECTIONSTRING` (read from Azure Portal: AppInsights -> Properties -> Connection String)
* `APPLICATIONSERVICES_PERSISTENCE_AZURESERVICEBUS_CONNECTIONSTRING` (read from Azure Portal: ServiceBus -> Shared Access Policies -> RootManageSharedAccessKey -> Primary Connection String)
* `APPLICATIONSERVICES_PERSISTENCE_AZURESTORAGEACCOUNT_ACCOUNTKEY` (read from Azure Portal: Storage Account -> Access keys -> key1)
Expand Down
5 changes: 5 additions & 0 deletions src/SaaStack.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,7 @@ public void When$condition$_Then$outcome$()
<s:Boolean x:Key="/Default/UserDictionary/Words/=afromdisplayname/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=afromemail/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=agivenname/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=aglobpattern/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ajurisdiction/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=akey/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=akeyhash/@EntryIndexedValue">True</s:Boolean>
Expand Down Expand Up @@ -1793,6 +1794,7 @@ public void When$condition$_Then$outcome$()
<s:Boolean x:Key="/Default/UserDictionary/Words/=authz/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=avalue/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=avalueobject/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=avariable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=avatared/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=averificationtoken/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=awholekey/@EntryIndexedValue">True</s:Boolean>
Expand Down Expand Up @@ -1822,6 +1824,7 @@ public void When$condition$_Then$outcome$()
<s:Boolean x:Key="/Default/UserDictionary/Words/=Dtos/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=el_0022_002C_0020Y/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=emaildelivery/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=emptyflatfile/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=emptyjson/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Equals_0028_0022adif/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=eventstore/@EntryIndexedValue">True</s:Boolean>
Expand Down Expand Up @@ -1905,7 +1908,9 @@ public void When$condition$_Then$outcome$()
<s:Boolean x:Key="/Default/UserDictionary/Words/=unknowntype/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=upserted/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=userpilot/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=validflatfile/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=validjson/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=validtext/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=valueobjects/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=websitehost/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=_0020_0020_0020_0020_0020_0020/@EntryIndexedValue">True</s:Boolean>
Expand Down
Loading

0 comments on commit bfda1e3

Please sign in to comment.