【日常】GitHubActionsでGAEの個人サイトが自動デプロイできるようになった話
こんばんは。Yoshimizuです。
今日はお家でラーメンを食べました。炒めたもやしと作った焼売をマルちゃん正麺醤油味にぶちこんで、美味しく頂きました。実家出てからはしばらくラーメン食べてなかったので、美味しかったです。
今回はGitHub Actionsで私の個人サイトである
が自動デプロイに対応しました。
これまでは、
1.Githubでpush
2.CloudShellでpull
3.CloudShellでgithubのprivateリポジトリのアカウント名とか入力する
4.CloudShellでdeploy
でしたが、今回ので
1.Githubでpush
だけで、サイトを更新することができます!!!!
テストが書いてあるわけではないので、CI/CDのCDしかありませんが、今後はコンポーネントのテストなど含めて、CIの部分も作れたらいいなって思います。
こんな感じです。
# This is a basic workflow to help you get started with Actions name: master-deploy # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch on: push: branches: [master] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" build: # The type of runner that the job will run on runs-on: ubuntu-latest # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: 10 - name: npm install build run: | npm install npm run build - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master with: version: "270.0.0" service_account_email: ${{ secrets.GCP_SA_EMAIL }} service_account_key: ${{ secrets.GCP_SA_KEY }} project_id: ${{ secrets.PROJECT_ID }} - name: GoogleAppEngine Deploy run: | gcloud info gcloud -q app deploy app.yaml
明日も頑張るぞ!