Skip to content

Commit

Permalink
Added deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
changesbyjames committed Nov 15, 2024
1 parent b4996e6 commit c9f75f1
Showing 1 changed file with 72 additions and 72 deletions.
144 changes: 72 additions & 72 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,75 +82,75 @@ jobs:
name: ui-build
path: app/dist

# deploy:
# name: deploy to production
# runs-on: ubuntu-22.04
# needs:
# - build_census_ui
# - build_census_api

# permissions:
# id-token: write

# environment: production
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4

# - uses: actions/download-artifact@v4
# with:
# name: ui-build
# path: ui

# - uses: pnpm/action-setup@v4
# name: Install pnpm
# with:
# version: 9
# run_install: false

# - name: Install Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 22
# cache: 'pnpm'

# - name: Install dependencies
# run: pnpm i

# - uses: pulumi/auth-actions@v1
# with:
# organization: alveusgg
# requested-token-type: urn:pulumi:token-type:access_token:personal
# scope: user:changesbyjames

# - name: Azure CLI Login
# uses: azure/login@v2
# with:
# client-id: ${{ secrets.AZURE_CLIENT_ID }}
# tenant-id: ${{ secrets.AZURE_TENANT_ID }}
# subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

# - uses: pulumi/actions@v5
# id: pulumi
# with:
# command: up
# stack-name: alveusgg/prod
# work-dir: infrastructure/pulumi
# config-map: |
# {
# "api-image": { value: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-${{ github.run_id }}-census-api", secret: false },
# }
# env:
# ARM_USE_OIDC: true
# ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
# ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}

# - name: az cli copy
# uses: azure/CLI@v2
# with:
# azcliversion: 2.53.0
# inlineScript: |
# az config set extension.use_dynamic_install=yes_without_prompt
# az storage azcopy blob upload --container \$web --source "./ui/*" --account-name ${{ steps.pulumi.outputs.accountName }} --recursive
# az cdn endpoint purge --resource-group ${{ steps.pulumi.outputs.resourceGroupName }} --name ${{ steps.pulumi.outputs.endpointName }} --profile-name ${{ steps.pulumi.outputs.profileName }} --content-paths "/*"
deploy:
name: deploy to production
runs-on: ubuntu-22.04
needs:
- build_census_ui
- build_census_api

permissions:
id-token: write

environment: production
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: ui-build
path: ui

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'

- name: Install dependencies
run: pnpm i

- uses: pulumi/auth-actions@v1
with:
organization: alveusgg
requested-token-type: urn:pulumi:token-type:access_token:personal
scope: user:changesbyjames

- name: Azure CLI Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- uses: pulumi/actions@v5
id: pulumi
with:
command: up
stack-name: alveusgg/prod
work-dir: infrastructure/pulumi
config-map: |
{
"api-image": { value: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-${{ github.run_id }}-census-api", secret: false },
}
env:
ARM_USE_OIDC: true
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}

- name: az cli copy
uses: azure/CLI@v2
with:
azcliversion: 2.53.0
inlineScript: |
az config set extension.use_dynamic_install=yes_without_prompt
az storage azcopy blob upload --container \$web --source "./ui/*" --account-name ${{ steps.pulumi.outputs.accountName }} --recursive
az cdn endpoint purge --resource-group ${{ steps.pulumi.outputs.resourceGroupName }} --name ${{ steps.pulumi.outputs.endpointName }} --profile-name ${{ steps.pulumi.outputs.profileName }} --content-paths "/*"

0 comments on commit c9f75f1

Please sign in to comment.