setup-gcloud/.github/workflows/appengine-deploy-it.yml
Bharath KKB 95e2d15420
fix: Update action names (#250) (#251)
Co-authored-by: Lewis Llobera <billobera@gmail.com>
2020-12-18 21:30:03 -06:00

166 lines
4.5 KiB
YAML

name: appengine-deploy Integration
on:
push:
paths:
- 'appengine-deploy/**'
- '.github/workflows/appengine-deploy*'
- 'setupGcloudSDK/**'
jobs:
gcloud:
name: with setup-gcloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: google-github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }}
export_default_credentials: true
- name: create app
run: |-
cat <<EOF > ${{ github.workspace }}/app.yaml
service: "${{ github.job }}-${{ github.run_number }}"
runtime: "nodejs10"
EOF
cat <<EOF > ${{ github.workspace }}/server.js
const http = require('http');
const server = http.createServer(function (req, res) {
res.writeHead(200)
res.end('Hello world!');
});
server.listen(process.env.PORT || 8080);
EOF
- name: Build dependency
working-directory: setupGcloudSDK
run: |-
npm install
npm run build
- id: build
name: Build dist
working-directory: appengine-deploy
run: |-
npm install
npm run build
- id: deploy
name: Deploy to App Engine
uses: ./appengine-deploy
with:
project_id: ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
deliverables: ${{ github.workspace }}/app.yaml
version: gcloud
- name: Test Output
run: |-
curl '${{ steps.deploy.outputs.url }}' \
--silent \
--fail \
--location \
--retry 5 \
--retry-connrefused \
--retry-delay 5 \
--retry-max-time 300
b64-json:
name: with base64 json creds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: create app
run: |-
cat <<EOF > ${{ github.workspace }}/app.yaml
service: "${{ github.job }}-${{ github.run_number }}"
runtime: "nodejs10"
EOF
cat <<EOF > ${{ github.workspace }}/server.js
const http = require('http');
const server = http.createServer(function (req, res) {
res.writeHead(200)
res.end('Hello world!');
});
server.listen(process.env.PORT || 8080);
EOF
- name: Build dependency
working-directory: setupGcloudSDK
run: |-
npm install
npm run build
- id: build
name: Build dist
working-directory: appengine-deploy
run: |-
npm install
npm run build
- id: deploy
name: Deploy to App Engine
uses: ./appengine-deploy
with:
credentials: ${{ secrets.APPENGINE_DEPLOY_SA_KEY_B64 }}
deliverables: ${{ github.workspace }}/app.yaml
version: b64-json
promote: false # Allows for deletion
- name: Test Output
run: |-
curl '${{ steps.deploy.outputs.url }}' \
--silent \
--fail \
--location \
--retry 5 \
--retry-connrefused \
--retry-delay 5 \
--retry-max-time 300
- name: Clean Up
run: gcloud app versions delete b64-json --quiet
json:
name: with json creds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: create app
run: |-
cat <<EOF > ${{ github.workspace }}/app.yaml
service: "${{ github.job }}-${{ github.run_number }}"
runtime: "nodejs10"
EOF
cat <<EOF > ${{ github.workspace }}/server.js
const http = require('http');
const server = http.createServer(function (req, res) {
res.writeHead(200)
res.end('Hello world!');
});
server.listen(process.env.PORT || 8080);
EOF
- name: Build dependency
working-directory: setupGcloudSDK
run: |-
npm install
npm run build
- id: build
name: Build dist
working-directory: appengine-deploy
run: |-
npm install
npm run build
- id: deploy
name: Deploy to App Engine
uses: ./appengine-deploy
with:
credentials: ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }}
deliverables: ${{ github.workspace }}/app.yaml
version: json
promote: false # Allows for deletion
- name: Test Output
run: |-
curl '${{ steps.deploy.outputs.url }}' \
--silent \
--fail \
--location \
--retry 5 \
--retry-connrefused \
--retry-delay 5 \
--retry-max-time 300
- name: Clean Up
run: gcloud app versions delete json --quiet