Skip to content

v4.11.0-preview.2

v4.11.0-preview.2 #174

Workflow file for this run

name: Publish to CDN
on:
release:
types: [published]
jobs:
build:
name: Build and deploy
runs-on: ubuntu-latest
environment: |-
${{
contains(github.event.release.tag_name, 'preview') && 'test'
|| contains(github.event.release.tag_name, 'rc') && 'staging'
|| 'prod'
}}
permissions:
id-token: write
steps:
- name: Validate tag
env:
REGEX: "${{ github.event.release.prerelease && '^v(\\d+)\\.(\\d+)\\.(\\d+)-(preview|rc)\\.\\d+$' ||
'^v(\\d+)\\.(\\d+)\\.(\\d+)$' }}"
run: |
echo "Validating that the tag is in the correct format"
echo "${{ github.event.release.tag_name }}" | grep -P $REGEX
- name: checkout
uses: actions/checkout@v4
with:
path: app-frontend
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: install node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: install dependencies
working-directory: app-frontend
run: yarn --immutable
- name: run build
working-directory: app-frontend
run: yarn build
- name: Checkout Altinn-CDN repository
uses: actions/checkout@v4
if: '!env.ACT'
with:
repository: 'Altinn/altinn-cdn'
token: ${{secrets.ALTINN_CDN_TOKEN}}
path: cdn
- name: Azure login
uses: azure/login@v2
if: '!env.ACT'
with:
client-id: ${{ secrets.AZURE_CLIENT_ID_FC }}
tenant-id: ${{ secrets.AZURE_TENANT_ID_FC }}
subscription-id: ${{ secrets.AZURE_CDN_SUBSCRIPTION_ID_FC }}
- name: Run release script
working-directory: app-frontend
if: '!env.ACT && !github.event.release.prerelease'
env:
FD_DOMAIN: ${{ vars.AZURE_DOMAIN_FC }}
FD_ENDPOINT: ${{ vars.AZURE_ENDPOINT_FC }}
FD_PROFILE: ${{ vars.AZURE_PROFILE_FC }}
FD_RESOURCEGROUP: ${{ vars.AZURE_RESOURCE_GROUP_FC }}
run: |
bash .github/scripts/release.sh \
--frontend . \
--cdn ../cdn \
--commit \
--azure-sync-cdn \
--azure-sa-name "${{ secrets.PRODUCTION_STORAGEACCOUNT_NAME }}" \
--azure-sa-token "${{ secrets.PRODUCTION_ALTINN_CDN_SAS_TOKEN }}"
- name: Run release script (pre-release)
working-directory: app-frontend
if: '!env.ACT && github.event.release.prerelease'
env:
FD_DOMAIN: ${{ vars.AZURE_DOMAIN_FC }}
FD_ENDPOINT: ${{ vars.AZURE_ENDPOINT_FC }}
FD_PROFILE: ${{ vars.AZURE_PROFILE_FC }}
FD_RESOURCEGROUP: ${{ vars.AZURE_RESOURCE_GROUP_FC }}
run: |
bash .github/scripts/release.sh \
--frontend . \
--cdn ../cdn \
--commit \
--pre-release \
--azure-sync-cdn \
--azure-sa-name "${{ secrets.PRODUCTION_STORAGEACCOUNT_NAME }}" \
--azure-sa-token "${{ secrets.PRODUCTION_ALTINN_CDN_SAS_TOKEN }}"
- name: Push to CDN
working-directory: cdn
if: '!env.ACT'
run: git push