什麼是 Github Actions

Features • GitHub Actions

GitHub Actions makes it easy to automate all your software workflows, now with world-class CI/CD. Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want.

過程

一剛開始我在 Features • GitHub Actions 找到 Beanstalk Deploy · Actions · GitHub Marketplace,測試了一下發現,雖然程式碼有上傳到 AWS Elastic Beanstalk,但是 Node.js 沒有正確地執行 npm run production

所以我在 step 前面加上了 Cache · Actions · GitHub Marketplace,先在 GitHub Action 內做好 npm run production 再壓縮成 zip 檔案部署至 AWS Elastic Beanstalk。

我猜測是 AWS Elastic Beanstalk 雖然會自行編譯 Node.js 以及 PHP Composer,不過 Laravel 對 Webpack 又包了一層 Laravel Mix,編譯指令已經和原先有落差。