|
| 1 | +name: deploy-appengine Integration |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + gcloud: |
| 7 | + if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }} |
| 8 | + name: with setup-gcloud |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v2 |
| 12 | + - uses: google-github-actions/setup-gcloud@master |
| 13 | + with: |
| 14 | + project_id: ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }} |
| 15 | + service_account_key: ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }} |
| 16 | + export_default_credentials: true |
| 17 | + - name: create app |
| 18 | + run: |- |
| 19 | + cat <<EOF > ${{ github.workspace }}/app.yaml |
| 20 | + service: "${{ github.job }}-${{ github.run_number }}" |
| 21 | + runtime: "nodejs10" |
| 22 | + EOF |
| 23 | +
|
| 24 | + cat <<EOF > ${{ github.workspace }}/server.js |
| 25 | + const http = require('http'); |
| 26 | + const server = http.createServer(function (req, res) { |
| 27 | + res.writeHead(200) |
| 28 | + res.end('Hello world!'); |
| 29 | + }); |
| 30 | + server.listen(process.env.PORT || 8080); |
| 31 | + EOF |
| 32 | + - name: Build dependency |
| 33 | + working-directory: setupGcloudSDK |
| 34 | + run: |- |
| 35 | + npm install |
| 36 | + npm run build |
| 37 | + - id: build |
| 38 | + name: Build dist |
| 39 | + run: |- |
| 40 | + npm install |
| 41 | + npm run build |
| 42 | + - id: deploy |
| 43 | + name: Deploy to App Engine |
| 44 | + uses: ./ |
| 45 | + with: |
| 46 | + project_id: ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }} |
| 47 | + deliverables: ${{ github.workspace }}/app.yaml |
| 48 | + version: gcloud |
| 49 | + promote: false |
| 50 | + - name: Test Output |
| 51 | + run: |- |
| 52 | + curl '${{ steps.deploy.outputs.url }}' \ |
| 53 | + --silent \ |
| 54 | + --fail \ |
| 55 | + --location \ |
| 56 | + --retry 5 \ |
| 57 | + --retry-connrefused \ |
| 58 | + --retry-delay 5 \ |
| 59 | + --retry-max-time 300 |
| 60 | + - name: Clean Up |
| 61 | + run: gcloud app services delete "${{ github.job }}-${{ github.run_number }}" --quiet |
| 62 | + |
| 63 | + b64-json: |
| 64 | + if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }} |
| 65 | + name: with base64 json creds |
| 66 | + runs-on: ubuntu-latest |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@v2 |
| 69 | + - name: create app |
| 70 | + run: |- |
| 71 | + cat <<EOF > ${{ github.workspace }}/app.yaml |
| 72 | + service: "${{ github.job }}-${{ github.run_number }}" |
| 73 | + runtime: "nodejs10" |
| 74 | + EOF |
| 75 | +
|
| 76 | + cat <<EOF > ${{ github.workspace }}/server.js |
| 77 | + const http = require('http'); |
| 78 | + const server = http.createServer(function (req, res) { |
| 79 | + res.writeHead(200) |
| 80 | + res.end('Hello world!'); |
| 81 | + }); |
| 82 | + server.listen(process.env.PORT || 8080); |
| 83 | + EOF |
| 84 | + - name: Build dependency |
| 85 | + working-directory: setupGcloudSDK |
| 86 | + run: |- |
| 87 | + npm install |
| 88 | + npm run build |
| 89 | + - id: build |
| 90 | + name: Build dist |
| 91 | + run: |- |
| 92 | + npm install |
| 93 | + npm run build |
| 94 | + - id: deploy |
| 95 | + name: Deploy to App Engine |
| 96 | + uses: ./ |
| 97 | + with: |
| 98 | + credentials: ${{ secrets.APPENGINE_DEPLOY_SA_KEY_B64 }} |
| 99 | + deliverables: ${{ github.workspace }}/app.yaml |
| 100 | + version: b64-json |
| 101 | + promote: false # Allows for deletion |
| 102 | + - name: Test Output |
| 103 | + run: |- |
| 104 | + curl '${{ steps.deploy.outputs.url }}' \ |
| 105 | + --silent \ |
| 106 | + --fail \ |
| 107 | + --location \ |
| 108 | + --retry 5 \ |
| 109 | + --retry-connrefused \ |
| 110 | + --retry-delay 5 \ |
| 111 | + --retry-max-time 300 |
| 112 | + - name: Clean Up |
| 113 | + run: gcloud app services delete "${{ github.job }}-${{ github.run_number }}" --quiet |
| 114 | + |
| 115 | + json: |
| 116 | + if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }} |
| 117 | + name: with json creds |
| 118 | + runs-on: ubuntu-latest |
| 119 | + steps: |
| 120 | + - uses: actions/checkout@v2 |
| 121 | + - name: create app |
| 122 | + run: |- |
| 123 | + cat <<EOF > ${{ github.workspace }}/app.yaml |
| 124 | + service: "${{ github.job }}-${{ github.run_number }}" |
| 125 | + runtime: "nodejs10" |
| 126 | + EOF |
| 127 | +
|
| 128 | + cat <<EOF > ${{ github.workspace }}/server.js |
| 129 | + const http = require('http'); |
| 130 | + const server = http.createServer(function (req, res) { |
| 131 | + res.writeHead(200) |
| 132 | + res.end('Hello world!'); |
| 133 | + }); |
| 134 | + server.listen(process.env.PORT || 8080); |
| 135 | + EOF |
| 136 | + - name: Build dependency |
| 137 | + working-directory: setupGcloudSDK |
| 138 | + run: |- |
| 139 | + npm install |
| 140 | + npm run build |
| 141 | + - id: build |
| 142 | + name: Build dist |
| 143 | + run: |- |
| 144 | + npm install |
| 145 | + npm run build |
| 146 | + - id: deploy |
| 147 | + name: Deploy to App Engine |
| 148 | + uses: ./ |
| 149 | + with: |
| 150 | + credentials: ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }} |
| 151 | + deliverables: ${{ github.workspace }}/app.yaml |
| 152 | + version: json |
| 153 | + promote: false # Allows for deletion |
| 154 | + - name: Test Output |
| 155 | + run: |- |
| 156 | + curl '${{ steps.deploy.outputs.url }}' \ |
| 157 | + --silent \ |
| 158 | + --fail \ |
| 159 | + --location \ |
| 160 | + --retry 5 \ |
| 161 | + --retry-connrefused \ |
| 162 | + --retry-delay 5 \ |
| 163 | + --retry-max-time 300 |
| 164 | + - name: Clean Up |
| 165 | + run: gcloud app services delete "${{ github.job }}-${{ github.run_number }}" --quiet |
0 commit comments