From ade970f016605430f12c183733a46cde3c01b458 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Wed, 7 Jul 2021 17:57:48 -0700 Subject: [PATCH 1/2] Initial commit for appengine deploy action --- .github/workflows/appengine_deploy.yml | 54 ++++++++++++++++++++++++++ gulpfile.js | 1 + package.json | 1 + scripts/gulpfiles/appengine_tasks.js | 16 ++++---- 4 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/appengine_deploy.yml diff --git a/.github/workflows/appengine_deploy.yml b/.github/workflows/appengine_deploy.yml new file mode 100644 index 00000000000..b6a8e54411d --- /dev/null +++ b/.github/workflows/appengine_deploy.yml @@ -0,0 +1,54 @@ +# This is a basic workflow to help you get started with Actions + +name: Deploy to App Engine + +# Controls when the workflow will run +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + prepare: + name: Prepare + # 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 + + - name: Prepare demo files + run: | + npm install + npm run prepareDemos + + - name: Upload + uses: actions/upload-artifact@v2 + with: + name: appengine_files + path: _deploy/ + + deploy: + name: Deploy + runs-on: ubuntu-latest + needs: prepare + steps: + - name: Download prepared files + uses: actions/download-artifact@v2 + with: + name: appengine_files + path: _deploy/ + + - name: Deploy to App Engine + uses: google-github-actions/deploy-appengine@v0.2.0 + with: + deliverables: app.yaml + working_directory: _deploy/ + # TODO: Set up project id and credentials secrets + project_id: ${{ secrets.GCP_PROJECT }} + credentials: ${{ secrets.GCP_SA_KEY }} + promote: false + # TODO: Generate a version string based on package.json + version: vtest diff --git a/gulpfile.js b/gulpfile.js index 49621147278..3f0dc46a436 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -39,6 +39,7 @@ module.exports = { package: packageTasks.package, checkLicenses: licenseTasks.checkLicenses, recompile: releaseTasks.recompile, + prepareDemos: appengineTasks.prepareDemos, publish: releaseTasks.publish, publishBeta: releaseTasks.publishBeta, sortRequires: cleanupTasks.sortRequires, diff --git a/package.json b/package.json index 3e9a293f2c1..33ac9283502 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "lint": "eslint .", "package": "gulp package", "prepare": "npm run package", + "prepareDemos": "gulp prepareDemos", "publish": "gulp publish", "publish:beta": "gulp publishBeta", "recompile": "gulp recompile", diff --git a/scripts/gulpfiles/appengine_tasks.js b/scripts/gulpfiles/appengine_tasks.js index 08fb3ea85ed..66573d3f52b 100644 --- a/scripts/gulpfiles/appengine_tasks.js +++ b/scripts/gulpfiles/appengine_tasks.js @@ -87,17 +87,19 @@ function deployAndClean(done) { done(); } +/** + * Prepares demos. + */ +const prepareDemos = gulp.series( + prepareDeployDir, copyStaticSrc, copyAppengineSrc, copyPlaygroundDeps); + + /** * Deploys demos. */ -const deployDemos = gulp.series( - prepareDeployDir, - copyStaticSrc, - copyAppengineSrc, - copyPlaygroundDeps, - deployAndClean -); +const deployDemos = gulp.series(prepareDemos, deployAndClean); module.exports = { deployDemos: deployDemos, + prepareDemos: prepareDemos } From c89d0c517e295212e48bf669a338146df6a107b6 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Thu, 8 Jul 2021 19:05:56 -0700 Subject: [PATCH 2/2] Update comments to be more descriptive --- .github/workflows/appengine_deploy.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/appengine_deploy.yml b/.github/workflows/appengine_deploy.yml index b6a8e54411d..f768874a31e 100644 --- a/.github/workflows/appengine_deploy.yml +++ b/.github/workflows/appengine_deploy.yml @@ -1,4 +1,4 @@ -# This is a basic workflow to help you get started with Actions +# Workflow that prepares files and deploys to appengine name: Deploy to App Engine @@ -7,19 +7,18 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: prepare: name: Prepare - # 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 + # Checks-out the repository under $GITHUB_WORKSPACE. + # When running manually this checks out the master branch. - uses: actions/checkout@v2 - name: Prepare demo files + # Install all dependencies, then copy all the files needed for demos. run: | npm install npm run prepareDemos @@ -33,6 +32,7 @@ jobs: deploy: name: Deploy runs-on: ubuntu-latest + # The prepare step must succeed for this step to run. needs: prepare steps: - name: Download prepared files @@ -43,12 +43,12 @@ jobs: - name: Deploy to App Engine uses: google-github-actions/deploy-appengine@v0.2.0 + # For parameters see: + # https://github.com/google-github-actions/deploy-appengine#inputs with: - deliverables: app.yaml working_directory: _deploy/ - # TODO: Set up project id and credentials secrets + deliverables: app.yaml project_id: ${{ secrets.GCP_PROJECT }} credentials: ${{ secrets.GCP_SA_KEY }} promote: false - # TODO: Generate a version string based on package.json version: vtest