Skip to content

Commit eb37ec9

Browse files
committed
actions for preview www
1 parent 68ca49f commit eb37ec9

3 files changed

Lines changed: 127 additions & 1 deletion

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Azure Preview WWW Cleanup
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
permissions:
8+
id-token: write
9+
contents: read
10+
11+
env:
12+
RESOURCE_GROUP: rg-designsystemet-test
13+
ACR_NAME: designsystemetacr
14+
APP_NAME: www-pr-${{ github.event.number }}
15+
16+
jobs:
17+
cleanup:
18+
if: ${{ github.repository == 'digdir/designsystemet' }}
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: az login (oidc)
24+
uses: azure/login@v2
25+
with:
26+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
27+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
28+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
29+
30+
- name: Delete Container App
31+
run: |
32+
echo "Attempting delete of $APP_NAME in $RESOURCE_GROUP"
33+
az containerapp show -n $APP_NAME -g $RESOURCE_GROUP >/dev/null 2>&1 \
34+
&& az containerapp delete -n $APP_NAME -g $RESOURCE_GROUP --yes \
35+
&& echo "Deleted $APP_NAME" \
36+
|| echo "Container app $APP_NAME not found (nothing to delete)"
37+
38+
- name: Summary
39+
run: echo "Cleanup complete for $APP_NAME" >> $GITHUB_STEP_SUMMARY
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Azure Preview WWW
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
paths:
8+
- 'apps/www/**'
9+
- 'internal/components/**'
10+
11+
permissions:
12+
id-token: write
13+
contents: read
14+
15+
env:
16+
RESOURCE_GROUP: rg-designsystemet-test
17+
CONTAINERAPPS_ENV: www-test-ca
18+
ACR_NAME: designsystemetacr
19+
APP_NAME: www-pr-${{ github.event.number }}
20+
PORT: '8000'
21+
22+
concurrency:
23+
group: azure-www-preview-${{ github.event.pull_request.number || github.run_id }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
deploy:
28+
if: ${{ github.repository == 'digdir/designsystemet' }}
29+
runs-on: ubuntu-latest
30+
outputs:
31+
fqdn: ${{ steps.fqdn.outputs.fqdn }}
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: az login (oidc)
36+
uses: azure/login@v2
37+
with:
38+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
39+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
40+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
41+
42+
- name: acr login
43+
run: az acr login --name ${{ env.ACR_NAME }}
44+
45+
- name: Build & push image
46+
uses: docker/build-push-action@v5
47+
with:
48+
context: .
49+
file: ./Dockerfile
50+
target: www
51+
platforms: linux/amd64
52+
push: true
53+
tags: ${{ env.ACR_NAME }}.azurecr.io/www:${{ env.APP_NAME }}-${{ github.sha }}
54+
55+
- name: Deploy / Update Container App
56+
uses: azure/container-apps-deploy-action@v1
57+
with:
58+
resourceGroup: ${{ env.RESOURCE_GROUP }}
59+
containerAppName: ${{ env.APP_NAME }}
60+
containerAppEnvironment: ${{ env.CONTAINERAPPS_ENV }}
61+
acrName: ${{ env.ACR_NAME }}
62+
imageToDeploy: ${{ env.ACR_NAME }}.azurecr.io/www:${{ env.APP_NAME }}-${{ github.sha }}
63+
targetPort: ${{ env.PORT }}
64+
ingress: external
65+
environmentVariables: |
66+
PORT=${{ env.PORT }}
67+
HOST=0.0.0.0
68+
69+
- name: Fetch FQDN
70+
id: fqdn
71+
run: |
72+
echo "Retrieving FQDN for $APP_NAME"
73+
FQDN=$(az containerapp show -n $APP_NAME -g $RESOURCE_GROUP --query properties.configuration.ingress.fqdn -o tsv)
74+
echo "fqdn=$FQDN" >> $GITHUB_OUTPUT
75+
76+
- name: Summary
77+
run: |
78+
echo "Preview deployed: https://${{ steps.fqdn.outputs.fqdn }}" >> $GITHUB_STEP_SUMMARY
79+
80+
update-comment:
81+
if: ${{ github.event_name == 'pull_request' }}
82+
needs: deploy
83+
uses: ./.github/workflows/preview-comment.yml
84+
with:
85+
pr_number: ${{ github.event.number }}
86+
deployment_type: www
87+
deployment_url: https://${{ needs.deploy.outputs.fqdn }}

apps/www/app/root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const loader = async ({ params, request }: Route.LoaderArgs) => {
7979

8080
const menu = [
8181
{
82-
name: 'navigation.fundamentals!',
82+
name: 'navigation.fundamentals!!',
8383
href: `/${lang}/fundamentals`,
8484
},
8585
{

0 commit comments

Comments
 (0)