Skip to content

Typings and dependency updates #317

Typings and dependency updates

Typings and dependency updates #317

Workflow file for this run

# Create containers and deploy to a test environment
# ---
# Note that this workflow uses OpenID Connect for secretless deployment to Azure.
#
# Variables that are not secrets and can be configured as Actions variables _or_ secrets:
# - AAD tenant ID, subscription ID, client ID for OpenID Connect
# - Azure Container Registry name and username
# - App Service endpoints, app names, and slot names
# - Test environment URLs
name: Ship it 🐿️
on:
push:
branches: [main]
permissions:
id-token: write
contents: read
jobs:
lint-and-test:
name: "Lint 'n test 🧺"
runs-on: ubuntu-latest
steps:
- name: Checkout πŸ›’
uses: actions/checkout@v4
- name: Packages πŸ“¦
run: |
npm ci
- name: Lint πŸ‘”
run: |
npm run lint
- name: Test πŸƒβ€β™‚οΈ
run: |
npm run test
# npm run-script build
# npm run-script test:ci
build:
name: 'Container delivery πŸš›'
runs-on: ubuntu-latest
environment:
name: development
steps:
- uses: actions/checkout@v4
#- uses: docker/build-push-action@v3
- name: Azure OpenID Connect ✨
if: github.repository == 'microsoft/opensource-management-portal' # official repo only
uses: azure/login@v1
with:
client-id: ${{ secrets.CLIENT_ID }}
tenant-id: ${{ secrets.TENANT_ID }}
subscription-id: ${{ secrets.SUBSCRIPTION_ID }}
- name: Connect to Azure Container Registry πŸ”–
if: github.repository == 'microsoft/opensource-management-portal' # official repo only
run: |
az acr login -n opensource
- name: Stamp build information πŸ’Œ
run: |
sed -i "s/__Build_BuildNumber__/${{ github.run_number }}/" package.json
sed -i "s/__Build_SourceVersion__/${{ github.sha }}/" package.json
echo package.json-stamped version:
cat package.json
- name: Use opensource deployment values πŸ“‘
if: github.repository == 'microsoft/opensource-management-portal' # official repo only
run: |
node .ossdev/build/packageBurn.js
node .ossdev/build/dockerfileForEnvironment.js
- name: Container build ⛴️
run: |
docker build \
-t ${{ github.event.repository.name }}:${{ github.run_number }} \
-t opensource.azurecr.io/${{ github.event.repository.name }}:${{ github.run_number }} \
-t opensource.azurecr.io/${{ github.event.repository.name }}:latest \
.
- name: Push to ACR πŸ“Œ
if: github.repository == 'microsoft/opensource-management-portal' # official repo only
run: |
docker image push opensource.azurecr.io/${{ github.event.repository.name }}:${{ github.run_number }}
docker image push opensource.azurecr.io/${{ github.event.repository.name }}:latest
development-stage:
name: Stage to development πŸ—οΈ
if: github.repository == 'microsoft/opensource-management-portal' # official repo only
runs-on: ubuntu-latest
needs: [build, lint-and-test]
environment:
name: development
url: https://portal-staging.ospo.dev
steps:
- name: Azure OpenID Connect ✨
uses: azure/login@v1
with:
client-id: ${{ secrets.CLIENT_ID }}
tenant-id: ${{ secrets.TENANT_ID }}
subscription-id: ${{ secrets.SUBSCRIPTION_ID }}
- name: Prepare staging slots 🎰
run: |
az webapp config container set \
--docker-custom-image-name opensource.azurecr.io/${{ github.event.repository.name }}:${{ github.run_number }} \
--docker-registry-server-url https://opensource.azurecr.io \
--name portalwestus3 \
--resource-group portal \
--slot staging
development:
name: Swap to live πŸ—οΈ
if: github.repository == 'microsoft/opensource-management-portal' # official repo only
runs-on: ubuntu-latest
needs: [development-stage]
environment:
name: development
url: https://portal.ospo.dev
steps:
- name: Azure OpenID Connect ✨
uses: azure/login@v1
with:
client-id: ${{ secrets.CLIENT_ID }}
tenant-id: ${{ secrets.TENANT_ID }}
subscription-id: ${{ secrets.SUBSCRIPTION_ID }}
- name: Swap staging to live πŸ’ƒ
run: |
az webapp deployment slot swap \
--name portalwestus3 \
--resource-group portal \
--slot staging