This repository has been archived by the owner on Jan 10, 2024. It is now read-only.
Create LICENSE #323
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: Deploy to Azure (githubnext-blocks-staging) | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node.js version | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Cache yarn | |
uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: yarn install | |
if: steps.cache-yarn.outputs.cache-hit != 'true' | |
run: | | |
yarn | |
- name: Cache next | |
uses: actions/cache@v3 | |
id: cache-next | |
with: | |
path: ${{ github.workspace }}/.next/cache | |
# Generate a new cache whenever packages or source files change. | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
# If source files changed but packages didn't, rebuild from a prior cache. | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn-lock') }}- | |
- name: yarn build | |
run: | | |
yarn build | |
- name: package zip | |
run: zip -r web.zip package.json next.config.js .next node_modules/ public/ | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: web-zip | |
path: web.zip | |
- name: "Deploy to Azure Web App" | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: "githubnext-blocks" | |
slot-name: "staging" | |
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE }} | |
package: web.zip |