This repository has been archived by the owner on Jul 31, 2023. It is now read-only.
Update nextjs monorepo to v13 (major) #185
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: Build & deploy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
outputs: | |
image-tag: ${{ steps.create-image-tag.outputs.result }} | |
steps: | |
- name: Create image tag | |
uses: actions/github-script@v6 | |
id: create-image-tag | |
with: | |
script: | | |
const date = new Date().toISOString().substring(0, 19).replace(/[:]/g, '-'); | |
const shortSha = context.sha.substring(0, 7); | |
return `${date}-${shortSha}`; | |
result-encoding: string | |
- name: Checking out code | |
uses: actions/checkout@v3 | |
- name: Set up node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install dependencies | |
run: npm install --legacy-peer-deps | |
- name: Logging into registry | |
uses: azure/docker-login@v1 | |
with: | |
login-server: nelliedev.azurecr.io | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Building Docker image | |
run: docker build . -t nelliedev.azurecr.io/hurtigruten/nellie.deeplink.builder:${{steps.create-image-tag.outputs.result}} | |
- name: Pushing Docker image | |
run: docker push nelliedev.azurecr.io/hurtigruten/nellie.deeplink.builder:${{steps.create-image-tag.outputs.result}} | |
deploy: | |
if: ${{ github.event_name == 'push' }} | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: 'production' | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
steps: | |
- name: Deploy to Azure Web App | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: 'nellie-deeplink-builder' | |
slot-name: 'production' | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
images: 'nelliedev.azurecr.io/hurtigruten/nellie.deeplink.builder:${{needs.build.outputs.image-tag}}' |