Merge pull request #19 from jeffwilcox/dependabot/npm_and_yarn/eslint… #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Ship it 🐿️ | |
permissions: | |
id-token: write | |
contents: read | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build 🏗 | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.npm | |
${{ github.workspace }}/.next/cache | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | |
- name: Install packages 📦 | |
shell: bash | |
run: | | |
npm ci | |
npm run build | |
- name: Azure ☁️ | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ vars.AKS_CLIENT_ID }} | |
tenant-id: ${{ vars.AKS_TENANT_ID }} | |
subscription-id: ${{ vars.AKS_SUBSCRIPTION_ID }} | |
- name: Connect to Azure Container Registry 🔖 | |
run: | | |
az acr login -n opensource | |
- 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 📌 | |
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 | |
stage: | |
name: Stage ⚡️ | |
runs-on: ubuntu-24.04 | |
needs: [build] | |
steps: | |
- name: Azure ☁️ | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ vars.AKS_CLIENT_ID }} | |
tenant-id: ${{ vars.AKS_TENANT_ID }} | |
subscription-id: ${{ vars.AKS_SUBSCRIPTION_ID }} | |
- name: Prepare staging slots 🎰 | |
run: | | |
az account set --subscription ${{ vars.AKS_SUBSCRIPTION_ID }} | |
echo West US 3 deployment 🌵 | |
az webapp config container set \ | |
--container-image-name opensource.azurecr.io/${{ github.event.repository.name }}:${{ github.run_number }} \ | |
--container-registry-url https://opensource.azurecr.io \ | |
--name jeffwilcox \ | |
--resource-group webapps \ | |
--slot staging | |
echo sleeping 30... | |
sleep 30 | |
echo OK. | |
swap: | |
name: Swap site ⚡️ | |
runs-on: ubuntu-24.04 | |
needs: [stage] | |
steps: | |
- name: Azure ☁️ | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ vars.AKS_CLIENT_ID }} | |
tenant-id: ${{ vars.AKS_TENANT_ID }} | |
subscription-id: ${{ vars.AKS_SUBSCRIPTION_ID }} | |
- name: Swap 💃 | |
run: | | |
az webapp deployment slot swap --name jeffwilcox --resource-group webapps --slot staging | |