Created
April 4, 2021 22:32
-
-
Save pranavq212/0322d73dbbf5cc46763a6f90c0592ef3 to your computer and use it in GitHub Desktop.
Revisions
-
Sidney Andrews created this gist
Oct 20, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,113 @@ name: Build Next.js web application on: push jobs: build-container: name: Build container runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Push to GitHub Packages uses: docker/build-push-action@v1 with: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: docker.pkg.github.com repository: ${{ github.repository }}/webnext tags: ${{ github.run_number }}, latest - name: Push to Docker Hub uses: docker/build-push-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} repository: msusdev/webnext tags: ${{ github.run_number }}, latest deploy-azure-containers: name: Deploy containers to Azure runs-on: ubuntu-latest needs: build-container env: WEB_APP_NAME: <web-app-name> steps: - name: Checkout code uses: actions/checkout@v2 - name: Login to Azure uses: azure/login@v1 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Deploy ACI instance uses: azure/arm-deploy@v1 with: subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }} resourcegroupName: <resource-group-name> template: azuredeploy.json - name: Deploy Web App container uses: azure/webapps-deploy@v2 with: app-name: ${{ env.WEB_APP_NAME }} images: msusdev/webnext deploy-azure-manual: name: Deploy code directly to Azure runs-on: ubuntu-latest needs: build-project env: WEB_APP_NAME: <web-app-name> steps: - name: Download site content uses: actions/download-artifact@v2 with: name: site-build - name: Login to Azure uses: azure/login@v1 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Deploy Web App code uses: azure/webapps-deploy@v2 with: app-name: ${{ env.WEB_APP_NAME }} package: . build-project: name: Build Next.js project runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Install NPM dependencies run: npm install - name: Build project assets run: npm run build - name: Upload site content uses: actions/upload-artifact@v2 with: name: site-build path: .next/ distribute-project: name: Distribute Next.js project to GitHub Releases runs-on: ubuntu-latest needs: build-project steps: - name: Download site content uses: actions/download-artifact@v2 with: name: site-build - name: Archive site content uses: thedoctor0/zip-release@master with: filename: site.zip - name: Create GitHub release id: create-new-release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: v${{ github.run_number }} release_name: Release ${{ github.run_number }} - name: Upload asset to GitHub release uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create-new-release.outputs.upload_url }} asset_path: ./site.zip asset_name: site-v${{ github.run_number }}.zip asset_content_type: application/zip