Deploy Next.js with Azure Static Web App Service and GitHub Actions (Video and Tutorial)

%3CLINGO-SUB%20id%3D%22lingo-sub-1413932%22%20slang%3D%22en-US%22%3EDeploy%20Next.js%20with%20Azure%20Static%20Web%20App%20Service%20and%20GitHub%20Actions%20(Video%20and%20Tutorial)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1413932%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20recently%20made%20a%20new%20video%20on%20using%20the%20coolest%20new%20feature%20released%20at%20Microsoft%20Build%202020%2C%20Static%20Web%20Apps.%20Last%20time%20we%20used%20Hugo%20and%20it%20was%20pretty%20darn%20easy.%20This%20time%20we'll%20focus%20on%20the%20React%20framework%20Next.js.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22%20fluidvids%22%3E%3CIFRAME%20src%3D%22https%3A%2F%2Fwww.youtube.com%2Fembed%2FPBqeEDpy6G0%22%20width%3D%22710%22%20height%3D%22399%22%20allowfullscreen%3D%22allowfullscreen%22%20class%3D%22%20fluidvids-elem%22%20loading%3D%22lazy%22%20data-mce-fragment%3D%221%22%3E%3C%2FIFRAME%3E%3C%2FDIV%3E%0A%3CP%3E%3CLI-WRAPPER%3E%3C%2FLI-WRAPPER%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1168458644%22%20id%3D%22toc-hId-1168458645%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fdeploy-next-js-with-azure-static-web-app-service-and-github-actions-32j0%23requirements%22%20name%3D%22requirements%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3C%2FA%3ERequirements%3C%2FH3%3E%0A%3CUL%3E%0A%3CLI%3EGitHub%20Account%3C%2FLI%3E%0A%3CLI%3EAzure%20Account%20-%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Ffree%2F%3FWT.mc_id%3Dblog-devto-jagord%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Echeck%20out%20the%20%24200%20in%20free%20credit%20trial%3C%2FA%3E.%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fwww.npmjs.com%2Fget-npm%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Enpm%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-%20at%20least%2010%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fblog.npmjs.org%2Fpost%2F162869356040%2Fintroducing-npx-an-npm-package-runner%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Enpx%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22toc-hId-1157955540%22%20id%3D%22toc-hId-1157955541%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fdeploy-next-js-with-azure-static-web-app-service-and-github-actions-32j0%23look-i-am-new-to-this%22%20name%3D%22look-i-am-new-to-this%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3C%2FA%3ELook%20I%20am%20new%20to%20this.%3C%2FH2%3E%0A%3CP%3ENo%20problem!%20A%20static%20site%20is%20more%20like%20a%20collection%20of%20HTML%20pages%20rather%20than%20dynamically%20rendered%20pages%20in%20the%20browser.%20We%20won't%20be%20accessing%20a%20database%20to%20provide%20the%20information%20in%20our%20site.%20In%20this%20case%2C%20we'll%20be%20creating%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E.js%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efiles%20that%20contain%20CSS%20and%20HTML%20that%20can%20easily%20be%20flattend%20into%20simple%20HTML.%20Once%20that%20HTML%20page%20is%20built%2C%20you%20can%20deploy%20the%20output%20to%20your%20web%20host.%3C%2FP%3E%0A%3CP%3EIn%20the%20past%2C%20serving%20these%20files%20required%20you%20to%20provide%20some%20form%20of%20simple%20web%20server%20along%20with%20the%20supportive%20storage%20to%20host%20the%20files.%20Before%20the%20cloud%2C%20these%20types%20of%20static%20pages%20would%20actually%20require%20virtual%20hosts%20on%20Apache%20Servers%20or%20IIS.%20This%20meant%20additional%20system%20administration%2C%20deployment%20methods%20and%20maintenance%20of%20the%20hardware.%20Deployments%20were%20not%20automatic%20either.%20Most%20of%20the%20time%2C%20new%20deployments%20using%20these%20older%20methods%20would%20be%20shipped%20by%20basic%20scripts%20or%20even%20via%20FTP.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--649498923%22%20id%3D%22toc-hId--649498922%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fdeploy-next-js-with-azure-static-web-app-service-and-github-actions-32j0%23what-is-nextjs%22%20name%3D%22what-is-nextjs%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3C%2FA%3EWhat%20is%20Next.js%3F%3C%2FH2%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jaydestro_0-1590256951100.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194079iD6AA534B4B63CB19%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22jaydestro_0-1590256951100.jpeg%22%20alt%3D%22jaydestro_0-1590256951100.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fnextjs.org%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3ENext.js%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20a%20static%20site%20generation%20framework.%20You%20build%20server-rendered%20React%20pages%20rather%20than%20dynamically%20generated%2C%20allowing%20you%20to%20quickly%20serve%20your%20website.%20The%20configuration%20is%20near%20minimal%20which%20makes%20it%20so%20powerful.%20Just%20create%20a%20site%2C%20add%20adtitional%20pages%2C%20use%20HTML%2FCSS%20and%20React%20to%20customize%20it%20to%20your%20needs.%3C%2FP%3E%0A%3CP%3ETons%20of%20big%20companies%20are%20using%20the%20Next.js%20frameworks%20like%20Hulu%2C%20Docker%2C%20Jet%20and%20many%20more.%20It's%20the%20ease%20of%20creation%20and%20deployment%20that%20really%20helps%20organizations%20like%20this%20ship%20faster%20and%20easier.%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fnextjs.org%2Flearn%2Fbasics%2Fcreate-nextjs-app%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EThis%20free%20interactive%20course%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewill%20guide%20you%20through%20how%20to%20get%20started%20with%20Next.js.%20For%20the%20case%20of%20this%20demo%20today%2C%20we'll%20use%20a%20pre-created%20site%20you%20can%20fork%20and%20modify.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1838013910%22%20id%3D%22toc-hId-1838013911%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fdeploy-next-js-with-azure-static-web-app-service-and-github-actions-32j0%23deployment-method%22%20name%3D%22deployment-method%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3C%2FA%3EDeployment%20Method%3C%2FH2%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jaydestro_1-1590256951108.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194080i10B39D8EB466FC7C%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22jaydestro_1-1590256951108.jpeg%22%20alt%3D%22jaydestro_1-1590256951108.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E-ERR%3AREF-NOT-FOUND-GitHub%20Actions%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20an%20API%20for%20cause%20and%20effect%20on%20GitHub%3A%20orchestrate%20any%20workflow%2C%20based%20on%20any%20event%2C%20while%20GitHub%20manages%20the%20execution%2C%20provides%20rich%20feedback%20and%20secures%20every%20step%20along%20the%20way.%20With%20GitHub%20Actions%2C%20workflows%20and%20steps%20are%20just%20code%20in%20a%20repository%2C%20so%20you%20can%20create%2C%20share%2C%20reuse%2C%20and%20fork%20your%20software%20development%20practices.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EGet%20Fast%20CI%2FCD%20-%20Any%20language%20or%20platform.%3C%2FLI%3E%0A%3CLI%3EYAML%20builds%3C%2FLI%3E%0A%3CLI%3ELive%20logging%3C%2FLI%3E%0A%3CLI%3EWorkflows%20are%20reusable%20-%20like%20code!%20(Hello%20fellow%20StackOverflow%20Devs!)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EIf%20you'd%20like%20to%20follow%20with%20this%20tutorial%2C%20make%20sure%20you%20have%20a%20GitHub%20account!%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-30559447%22%20id%3D%22toc-hId-30559448%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fdeploy-next-js-with-azure-static-web-app-service-and-github-actions-32j0%23azure-static-web-apps%22%20name%3D%22azure-static-web-apps%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3C%2FA%3EAzure%20Static%20Web%20Apps%3C%2FH2%3E%0A%3CP%3EAccelerate%20your%20app%20development%20with%20a%20static%20front%20end%20and%20dynamic%20back%20end%20powered%20by%20serverless%20APIs.%20Experience%20high%20productivity%20with%20a%20tailored%20local%20development%20experience%2C%20GitHub%20native%20workflows%20to%20build%20and%20deploy%20your%20app%2C%20and%20unified%20hosting%20and%20management%20in%20the%20cloud.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EProductivity%20from%20local%20development%20to%20GitHub%20native%20workflows%20for%20CI%2FCD%3C%2FLI%3E%0A%3CLI%3EManaged%20global%20availability%20for%20static%20content%3C%2FLI%3E%0A%3CLI%3EDynamic%20scale%20for%20serverless%20APIs%3C%2FLI%3E%0A%3CLI%3EStreamlined%20management%20including%20custom%20domain%20configuration%20and%20authentication%20and%20authorization%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EAzure%20Static%20Web%20Apps%20allows%20for%20native%20GitHub%20integration%20so%20that%20when%20you%20deploy%2C%20your%20workflow%20file%20will%20be%20generated%20for%20you%2C%20allowing%20you%20to%20build%20and%20deploy%20right%20to%20Azure.%3C%2FP%3E%0A%3CP%3EIf%20you%20don't%20have%20an%20Azure%20account%20yet%20and%20you'd%20like%20to%20follow%20along%20with%20this%20post%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Ffree%2F%3FWT.mc_id%3Dblog-devto-jagord%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Echeck%20out%20the%20%24200%20in%20free%20credit%20trial%3C%2FA%3E.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1776895016%22%20id%3D%22toc-hId--1776895015%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fdeploy-next-js-with-azure-static-web-app-service-and-github-actions-32j0%23getting-started%22%20name%3D%22getting-started%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3C%2FA%3EGetting%20Started%3C%2FH2%3E%0A%3CP%3EFork%20this%20repository%20into%20your%20GitHub%20account.%20It's%20just%20a%20silly%20static%20site%20dedicated%20to%20my%20pug%20Rico.%3C%2FP%3E%0A%3CDIV%20class%3D%22ltag-github-readme-tag%22%3E%0A%3CDIV%20class%3D%22readme-overview%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jaydestro_2-1590256951108.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194078iE9E2C8A66F5F878E%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22jaydestro_2-1590256951108.png%22%20alt%3D%22jaydestro_2-1590256951108.png%22%20%2F%3E%3C%2FSPAN%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-710617817%22%20id%3D%22toc-hId-710617818%22%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fjaydestro%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ejaydestro%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FA%3E%2F%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fjaydestro%2Fricoinfojs%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ericoinfojs%3C%2FA%3E%3C%2FH2%3E%0A%3CH3%20id%3D%22toc-hId-1401179291%22%20id%3D%22toc-hId-1401179292%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3C%2FDIV%3E%0A%3CDIV%20class%3D%22ltag-github-body%22%3E%0A%3CDIV%20id%3D%22readme%22%20class%3D%22md%22%20data-path%3D%22README.md%22%3E%0A%3CARTICLE%20class%3D%22markdown-body%20entry-content%20container-lg%22%3E%0A%3CP%3EThis%20is%20a%20starter%20template%20for%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fnextjs.org%2Flearn%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20target%3D%22_blank%22%3ELearn%20Next.js%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3EThis%20is%20a%20basic%20website%20about%20my%20dog%20that%20is%20used%20for%20deployment%20to%20different%20static%20site%20host.%3C%2FP%3E%0A%3CP%3EStart%20locally%20with%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Enpn%20dev%20start%3C%2FCODE%3E%3C%2FP%3E%0A%3CP%3EExport%20pages%20using%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Enpx%20next%20build%20%26amp%3B%26amp%3B%20npm%20next%20export%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20find%20your%20static%20content%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eout%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Edirectory.%3C%2FP%3E%0A%3C%2FARTICLE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CBR%20%2F%3E%0A%3CDIV%20class%3D%22gh-btn-container%22%3E-ERR%3AREF-NOT-FOUND-View%20on%20GitHub%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you'd%20like%20to%20test%20out%20the%20application%20before%20you%20deploy%20it%2C%20you%20can%20clone%20the%20application%20locally%20and%20start%20the%20development%20server%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Egit%20clone%20https%3A%2F%2Fgithub.com%2Fjaydestro%2Friconext.git%0Acd%20riconext%0Anpm%20install%0Anpm%20run%20dev%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EYou%20should%20now%20have%20a%20development%20Node%20server%20running%20at%20localhost%20on%20port%203000%20for%20you%20to%20test%20your%20website%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jaydestro_3-1590256951109.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194083i1758A31F718F4DE9%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22jaydestro_3-1590256951109.jpeg%22%20alt%3D%22jaydestro_3-1590256951109.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20modify%20the%20site%20in%20any%20way%20or%20just%20follow%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fnextjs.org%2Fdocs%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3ENext.js%20documentation%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eon%20creating%20your%20own%20example%20site.%3C%2FP%3E%0A%3CP%3EWhen%20you've%20completed%20your%20design%20and%20are%20ready%20to%20build%20the%20static%20pages%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1390676187%22%20id%3D%22toc-hId-1390676188%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fdeploy-next-js-with-azure-static-web-app-service-and-github-actions-32j0%23create-your-static-web-app-service%22%20name%3D%22create-your-static-web-app-service%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3C%2FA%3ECreate%20your%20Static%20Web%20App%20Service%3C%2FH2%3E%0A%3CP%3ECreating%20the%20service%20just%20takes%20a%20few%20steps%2C%20here's%20how%20to%20get%20started%20in%20the%20Azure%20Portal.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%0A%3CP%3EGo%20to%20your%20Azure%20Portal%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EIn%20the%20upper%20left%20hand%20corner%20of%20your%20portal%20click%20the%20three%20dashes%2C%20click%20%22Create%20a%20resource%22%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jaydestro_4-1590256951110.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194081iCDAAC94657AA6437%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22jaydestro_4-1590256951110.jpeg%22%20alt%3D%22jaydestro_4-1590256951110.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%0A%3CP%3EIn%20the%20%22Search%20the%20Marketplace%22%20search%20bar%2C%20type%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%22Static%20Web%20App%20(Preview)%22%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-%20hit%20enter%20and%20you'll%20be%20taken%20to%20the%20Azure%20Resource%20Manager%20template%20to%20create%20the%20site.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EClick%20the%20%22Create%22%20button%20in%20the%20Azure%20Marketplace%20description%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jaydestro_5-1590256951111.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194082i2D525EF972864B4C%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22jaydestro_5-1590256951111.jpeg%22%20alt%3D%22jaydestro_5-1590256951111.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%0A%3CP%3ESelect%20your%20subscription%2C%20then%20create%20a%20new%2C%20or%20select%20a%20resource%20group%20would%20like%20to%20create%20your%20app%20in.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EProvide%20it%20with%20a%20name%20to%20identfy%20your%20App%20(this%20will%20not%20be%20the%20hostname)%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ESelect%20one%20of%20the%20Azure%20Regions%20the%20service%20is%20available%20in.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ESelect%20the%20SKU%20Free!%20(that's%20right%2C%20free!)%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EClick%20%22Sign%20in%20with%20GitHub%22%20for%20your%20source%20control%20-%20authenticate%20your%20GitHub%20account%20(you%20will%20need%20this!)%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jaydestro_6-1590256951112.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194084iDB003440039DDD1F%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22jaydestro_6-1590256951112.jpeg%22%20alt%3D%22jaydestro_6-1590256951112.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%0A%3CP%3ESelect%20your%20Organization%2C%20in%20my%20case%20it's%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Ejaydestro%3C%2FCODE%3E%2C%20Select%20your%20repository%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Ericonext%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20finally%20the%20branch%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Emaster%3C%2FCODE%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EClick%20the%20Build%20button%20at%20the%20bottom%20to%20select%20your%20build%20details%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EUpdate%20the%20build%20details%20with%20the%20following%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EApp%20Location%20%3A%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E%2F%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3EThis%20is%20the%20location%20of%20your%20application%20code.%20For%20example%2C%20'%2F'%20represents%20the%20root%20of%20your%20app%2C%20while%20'%2Fapp'%20represents%20a%20directory%20called%20'app'.%3C%2FLI%3E%0A%3CLI%3EApi%20location%3A%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ELEAVE%20BLANK%2C%20DELETE%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eapi%3C%2FCODE%3E%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3ELocation%20of%20your%20Azure%20Functions%20code.%20For%20example%2C%20'%2Fapi'%20represents%20a%20folder%20called%20'api'.%3C%2FLI%3E%0A%3CLI%3EApp%20artifact%20location%3A%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Epublic%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3EThe%20path%20of%20your%20build%20output%20relative%20to%20your%20apps%20location.%20For%20example%2C%20setting%20a%20value%20of%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Ebuild%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewhen%20your%20app%20location%20is%20set%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E%2Fapp%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewill%20cause%20the%20content%20at%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E%2Fapp%2Fbuild%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20be%20served.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jaydestro_7-1590256951113.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194085iFCAF44AB5E1B4196%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22jaydestro_7-1590256951113.jpeg%22%20alt%3D%22jaydestro_7-1590256951113.jpeg%22%20%2F%3E%3C%2FSPAN%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EClick%20%22Review%20and%20Create%22%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EReview%20your%20summary%20and%20click%20create!%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22toc-hId--416778276%22%20id%3D%22toc-hId--416778275%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fdeploy-next-js-with-azure-static-web-app-service-and-github-actions-32j0%23build-with-github-actions%22%20name%3D%22build-with-github-actions%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3C%2FA%3EBuild%20with%20GitHub%20Actions%3C%2FH2%3E%0A%3CP%3ESince%20you've%20created%20a%20trust%20between%20GitHub%20and%20Azure%2C%20you%20Azure%20will%20drop%20a%20workflow%20file%20into%20your%20repository%20located%20in%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E.github%2Fworkflows%3C%2FCODE%3E.%20Azure%20will%20create%20a%20YAML%20file%20in%20the%20directory%20for%20you%20with%20the%20directions%20on%20how%20to%20build%20and%20deploy%20your%20application.%20The%20YAML%20file%20will%20have%20a%20name%20that%20will%20be%20similar%20to%20the%20randomized%20hostname%20eventually%20created%20for%20you.%3C%2FP%3E%0A%3CP%3EHere's%20an%20example%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Ename%3A%20Azure%20Static%20Web%20Apps%20CI%2FCD%0A%0Aon%3A%0A%20%20push%3A%0A%20%20%20%20branches%3A%0A%20%20%20%20-%20master%0A%20%20pull_request%3A%0A%20%20%20%20types%3A%20%5Bopened%2C%20synchronize%2C%20reopened%2C%20closed%5D%0A%20%20%20%20branches%3A%0A%20%20%20%20-%20master%0A%0Ajobs%3A%0A%20%20build_and_deploy_job%3A%0A%20%20%20%20if%3A%20github.event_name%20%3D%3D%20'push'%20%7C%7C%20(github.event_name%20%3D%3D%20'pull_request'%20%26amp%3B%26amp%3B%20github.event.action%20!%3D%20'closed')%0A%20%20%20%20runs-on%3A%20ubuntu-latest%0A%20%20%20%20name%3A%20Build%20and%20Deploy%20Job%0A%20%20%20%20steps%3A%0A%20%20%20%20-%20uses%3A%20actions%2Fcheckout%40v2%0A%20%20%20%20-%20name%3A%20Build%20And%20Deploy%0A%20%20%20%20%20%20id%3A%20builddeploy%0A%20%20%20%20%20%20uses%3A%20Azure%2Fstatic-web-apps-deploy%40v0.0.1-preview%0A%20%20%20%20%20%20with%3A%0A%20%20%20%20%20%20%20%20azure_static_web_apps_api_token%3A%20%24%7B%7B%20secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GREEN_MUD_0FB62DF0F%20%7D%7D%0A%20%20%20%20%20%20%20%20repo_token%3A%20%24%7B%7B%20secrets.GITHUB_TOKEN%20%7D%7D%20%23%20Used%20for%20Github%20integrations%20(i.e.%20PR%20comments)%0A%20%20%20%20%20%20%20%20action%3A%20'upload'%0A%20%20%20%20%20%20%20%20%23%23%23%23%23%23%20Repository%2FBuild%20Configurations%20-%20These%20values%20can%20be%20configured%20to%20match%20you%20app%20requirements.%20%23%23%23%23%23%23%0A%20%20%20%20%20%20%20%20%23%20For%20more%20information%20regarding%20Static%20Web%20App%20workflow%20configurations%2C%20please%20visit%3A%20https%3A%2F%2Faka.ms%2Fswaworkflowconfig%20%0A%20%20%20%20%20%20%20%20app_location%3A%20'%2F'%20%23%20App%20source%20code%20path%0A%20%20%20%20%20%20%20%20api_location%3A%20'api'%20%23%20Api%20source%20code%20path%20-%20optional%0A%20%20%20%20%20%20%20%20app_artifact_location%3A%20'public'%20%23%20Built%20app%20content%20directory%20-%20optional%0A%20%20%20%20%20%20%20%20%23%23%23%23%23%23%20End%20of%20Repository%2FBuild%20Configurations%20%23%23%23%23%23%23%0A%0A%20%20close_pull_request_job%3A%0A%20%20%20%20if%3A%20github.event_name%20%3D%3D%20'pull_request'%20%26amp%3B%26amp%3B%20github.event.action%20%3D%3D%20'closed'%0A%20%20%20%20runs-on%3A%20ubuntu-latest%0A%20%20%20%20name%3A%20Close%20Pull%20Request%20Job%0A%20%20%20%20steps%3A%0A%20%20%20%20-%20name%3A%20Close%20Pull%20Request%0A%20%20%20%20%20%20id%3A%20closepullrequest%0A%20%20%20%20%20%20uses%3A%20Azure%2Fstatic-web-apps-deploy%40v0.0.1-preview%0A%20%20%20%20%20%20with%3A%0A%20%20%20%20%20%20%20%20azure_static_web_apps_api_token%3A%20%24%7B%7B%20secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GREEN_MUD_0FB62DF0F%20%7D%7D%0A%20%20%20%20%20%20%20%20action%3A%20'close'%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3ENow%20whenever%20we%20commit%20to%20master%20GitHub%20Actions%20will%20follow%20the%20instructions%20in%20the%20GitHub%20Actions%20workflow%20file.%20If%20we%20wanted%20to%20add%20tests%2C%20make%20changes%20or%20anything%20else%2C%20all%20master%20deploys%20will%20automatically%20build%20and%20deploy.%20Let's%20look%20at%20what%20GitHub%20Actions%20has%20done.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jaydestro_8-1590256951113.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194086i0762D043CFA5AFFD%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22jaydestro_8-1590256951113.jpeg%22%20alt%3D%22jaydestro_8-1590256951113.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGitHub%20Actions%20was%20triggered%20by%20the%20commit%20of%20the%20YAML%20file%20into%20my%20repository.%20This%20triggered%20action%20tells%20GitHub%20Actions%20based%20on%20the%20workflow%20file%20in%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E.github%5Cworkflows%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20build%20our%20static%20web%20app%20then%20deploy%20it%20to%20the%20App%20Service.%20Actions%20will%20provide%20you%20logs%20of%20your%20build%20and%20deploy%20so%20you%20can%20troubleshoot%20when%20issues%20arise.%3C%2FP%3E%0A%3CP%3EOnce%20the%20build%20is%20completed%20you'll%20get%20a%20summary%20of%20what%20occurred%20during%20deployment.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jaydestro_9-1590256951114.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194089i4BA2C89EEA2F8666%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22jaydestro_9-1590256951114.jpeg%22%20alt%3D%22jaydestro_9-1590256951114.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20our%20deployment%20has%20completed%20you%20can%20now%20navigate%20back%20to%20the%20Azure%20portal%20and%20view%20the%20details%20and%20hostname%20of%20your%20new%20deployment%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jaydestro_10-1590256951115.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194087i51EF76C25AC3BC0A%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22jaydestro_10-1590256951115.jpeg%22%20alt%3D%22jaydestro_10-1590256951115.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20I%20click%20on%20the%20hostname%2C%20I%20am%20now%20able%20to%20see%20my%20new%20website!%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jaydestro_11-1590256951115.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194088i337C254A68DDF175%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22jaydestro_11-1590256951115.jpeg%22%20alt%3D%22jaydestro_11-1590256951115.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20have%20options%20to%20integrate%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fazure-functions%2F%3FWT.mc_id%3Dblog-devto-jagord%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Functions%3C%2FA%3E%2C%20add%20a%20custom%20hostname%20or%20even%20set%20up%20staging%20environments%20that%20are%20automatically%20created%20when%20a%20pull%20request%20is%20generated%2C%20and%20are%20promoted%20into%20production%20once%20the%20pull%20request%20is%20merged.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--550463000%22%20id%3D%22toc-hId--550462999%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fdeploy-next-js-with-azure-static-web-app-service-and-github-actions-32j0%23links-to-help-you%22%20name%3D%22links-to-help-you%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3C%2FA%3ELinks%20to%20help%20you!%3C%2FH2%3E%0A%3CP%3EAlmost%20any%20static%20content%20will%20work%20using%20this%20service%20making%20your%20decision%20of%20what%20to%20use%20nearly%20limitless.%3C%2FP%3E%0A%3CP%3EThe%20tutorial%20should%20help%20provide%20you%20with%20a%20great%20start%20on%20using%20this%20service%20with%20your%20Azure%20Static%20Web%20App%20Service.%20Utilizing%20resources%20like%20GitHub%20actions%20can%20help%20you%20on%20your%20journey%20to%20becoming%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-Microsoft%20DevOps%20Certified%20Expert.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EMicrosoft%20Learn%3A%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-Azure%20Fundamentals%3C%2FLI%3E%0A%3CLI%3EMicrosoft%20Learn%3A%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Flearn%2Fmodules%2Fpublish-app-service-static-web-app-api%2F%3FWT.mc_id%3Ddevto-blog-jagord%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EDeploy%20Static%20Web%20App%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EMicrosoft%20Docs%3A%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-App%20Service%20Documentation%3C%2FLI%3E%0A%3CLI%3E-ERR%3AREF-NOT-FOUND-GitHub%20Actions%20Documentation%3C%2FLI%3E%0A%3CLI%3E-ERR%3AREF-NOT-FOUND-Get%2012%20Months%20of%20free%20service%20and%20%24200%20for%20Microsoft%20Azure%3C%2FLI%3E%0A%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1413932%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EApp%20Services%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Essentials%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDevOps%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Microsoft

 

I recently made a new video on using the coolest new feature released at Microsoft Build 2020, Static Web Apps. Last time we used Hugo and it was pretty darn easy. This time we'll focus on the React framework Next.js.

 

 

Requirements

Look I am new to this.

No problem! A static site is more like a collection of HTML pages rather than dynamically rendered pages in the browser. We won't be accessing a database to provide the information in our site. In this case, we'll be creating .js files that contain CSS and HTML that can easily be flattend into simple HTML. Once that HTML page is built, you can deploy the output to your web host.

In the past, serving these files required you to provide some form of simple web server along with the supportive storage to host the files. Before the cloud, these types of static pages would actually require virtual hosts on Apache Servers or IIS. This meant additional system administration, deployment methods and maintenance of the hardware. Deployments were not automatic either. Most of the time, new deployments using these older methods would be shipped by basic scripts or even via FTP.

What is Next.js?

jaydestro_0-1590256951100.jpeg

 

Next.js is a static site generation framework. You build server-rendered React pages rather than dynamically generated, allowing you to quickly serve your website. The configuration is near minimal which makes it so powerful. Just create a site, add adtitional pages, use HTML/CSS and React to customize it to your needs.

Tons of big companies are using the Next.js frameworks like Hulu, Docker, Jet and many more. It's the ease of creation and deployment that really helps organizations like this ship faster and easier.

This free interactive course will guide you through how to get started with Next.js. For the case of this demo today, we'll use a pre-created site you can fork and modify.

Deployment Method

jaydestro_1-1590256951108.jpeg

 

GitHub Actions is an API for cause and effect on GitHub: orchestrate any workflow, based on any event, while GitHub manages the execution, provides rich feedback and secures every step along the way. With GitHub Actions, workflows and steps are just code in a repository, so you can create, share, reuse, and fork your software development practices.

  • Get Fast CI/CD - Any language or platform.
  • YAML builds
  • Live logging
  • Workflows are reusable - like code! (Hello fellow StackOverflow Devs!)

If you'd like to follow with this tutorial, make sure you have a GitHub account!

Azure Static Web Apps

Accelerate your app development with a static front end and dynamic back end powered by serverless APIs. Experience high productivity with a tailored local development experience, GitHub native workflows to build and deploy your app, and unified hosting and management in the cloud.

  • Productivity from local development to GitHub native workflows for CI/CD
  • Managed global availability for static content
  • Dynamic scale for serverless APIs
  • Streamlined management including custom domain configuration and authentication and authorization

Azure Static Web Apps allows for native GitHub integration so that when you deploy, your workflow file will be generated for you, allowing you to build and deploy right to Azure.

If you don't have an Azure account yet and you'd like to follow along with this post, check out the $200 in free credit trial.

Getting Started

Fork this repository into your GitHub account. It's just a silly static site dedicated to my pug Rico.

This is a starter template for Learn Next.js.

This is a basic website about my dog that is used for deployment to different static site host.

Start locally with npn dev start

Export pages using npx next build && npm next export and find your static content in the out directory.


 

If you'd like to test out the application before you deploy it, you can clone the application locally and start the development server:

git clone https://github.com/jaydestro/riconext.git
cd riconext
npm install
npm run dev

You should now have a development Node server running at localhost on port 3000 for you to test your website:

jaydestro_3-1590256951109.jpeg

 

You can modify the site in any way or just follow the Next.js documentation on creating your own example site.

When you've completed your design and are ready to build the static pages

Create your Static Web App Service

Creating the service just takes a few steps, here's how to get started in the Azure Portal.

  1. Go to your Azure Portal

  2. In the upper left hand corner of your portal click the three dashes, click "Create a resource"

jaydestro_4-1590256951110.jpeg

 

  1. In the "Search the Marketplace" search bar, type "Static Web App (Preview)" - hit enter and you'll be taken to the Azure Resource Manager template to create the site.

  2. Click the "Create" button in the Azure Marketplace description

jaydestro_5-1590256951111.jpeg

 

  1. Select your subscription, then create a new, or select a resource group would like to create your app in.

  2. Provide it with a name to identfy your App (this will not be the hostname)

  3. Select one of the Azure Regions the service is available in.

  4. Select the SKU Free! (that's right, free!)

  5. Click "Sign in with GitHub" for your source control - authenticate your GitHub account (you will need this!)

jaydestro_6-1590256951112.jpeg

 

  1. Select your Organization, in my case it's jaydestro, Select your repository riconext and finally the branch master

  2. Click the Build button at the bottom to select your build details

  3. Update the build details with the following:

    1. App Location : / This is the location of your application code. For example, '/' represents the root of your app, while '/app' represents a directory called 'app'.
    2. Api location: LEAVE BLANK, DELETE api Location of your Azure Functions code. For example, '/api' represents a folder called 'api'.
    3. App artifact location: public The path of your build output relative to your apps location. For example, setting a value of build when your app location is set to /app will cause the content at /app/build to be served.
    jaydestro_7-1590256951113.jpeg

     

  4. Click "Review and Create"

  5. Review your summary and click create!

Build with GitHub Actions

Since you've created a trust between GitHub and Azure, you Azure will drop a workflow file into your repository located in .github/workflows. Azure will create a YAML file in the directory for you with the directions on how to build and deploy your application. The YAML file will have a name that will be similar to the randomized hostname eventually created for you.

Here's an example:

name: Azure Static Web Apps CI/CD

on:
  push:
    branches:
    - master
  pull_request:
    types: [opened, synchronize, reopened, closed]
    branches:
    - master

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    steps:
    - uses: actions/checkout@v2
    - name: Build And Deploy
      id: builddeploy
      uses: Azure/static-web-apps-deploy@v0.0.1-preview
      with:
        azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GREEN_MUD_0FB62DF0F }}
        repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
        action: 'upload'
        ###### Repository/Build Configurations - These values can be configured to match you app requirements. ######
        # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig 
        app_location: '/' # App source code path
        api_location: 'api' # Api source code path - optional
        app_artifact_location: 'public' # Built app content directory - optional
        ###### End of Repository/Build Configurations ######

  close_pull_request_job:
    if: github.event_name == 'pull_request' && github.event.action == 'closed'
    runs-on: ubuntu-latest
    name: Close Pull Request Job
    steps:
    - name: Close Pull Request
      id: closepullrequest
      uses: Azure/static-web-apps-deploy@v0.0.1-preview
      with:
        azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GREEN_MUD_0FB62DF0F }}
        action: 'close'

Now whenever we commit to master GitHub Actions will follow the instructions in the GitHub Actions workflow file. If we wanted to add tests, make changes or anything else, all master deploys will automatically build and deploy. Let's look at what GitHub Actions has done.

jaydestro_8-1590256951113.jpeg

 

GitHub Actions was triggered by the commit of the YAML file into my repository. This triggered action tells GitHub Actions based on the workflow file in .github\workflows to build our static web app then deploy it to the App Service. Actions will provide you logs of your build and deploy so you can troubleshoot when issues arise.

Once the build is completed you'll get a summary of what occurred during deployment.

jaydestro_9-1590256951114.jpeg

 

Once our deployment has completed you can now navigate back to the Azure portal and view the details and hostname of your new deployment:

jaydestro_10-1590256951115.jpeg

 

If I click on the hostname, I am now able to see my new website!

jaydestro_11-1590256951115.jpeg

 

We have options to integrate Azure Functions, add a custom hostname or even set up staging environments that are automatically created when a pull request is generated, and are promoted into production once the pull request is merged.

Links to help you!

Almost any static content will work using this service making your decision of what to use nearly limitless.

The tutorial should help provide you with a great start on using this service with your Azure Static Web App Service. Utilizing resources like GitHub actions can help you on your journey to becoming a Microsoft DevOps Certified Expert.

0 Replies