forked from apache/beam
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (88 loc) · 3.9 KB
/
build_playground_frontend.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Build And Deploy Playground Frontend Application
on:
push:
tags: ['v*']
branches: ['master', 'release-*']
pull_request:
paths: ['playground/backend/**']
branches: ['playground-staging']
workflow_dispatch:
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build_playground_frontend_docker_image:
name: Build Playground Frontend App
runs-on: [self-hosted, ubuntu-20.04]
env:
GO_VERSION: 1.18.0
BEAM_VERSION: 2.40.0
TERRAFORM_VERSION: 1.0.9
FLUTTER_VERSION: 3.3.2
STAND_SUFFIX: ''
GOOGLE_DOMAIN: '-dot-apache-beam-testing.appspot.com'
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3.8.0
with:
distribution: 'zulu'
java-version: '8'
- name: Install Flutter
run: |
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_$FLUTTER_VERSION-stable.tar.xz &&\
tar -xf flutter_linux_$FLUTTER_VERSION-stable.tar.xz &&\
sudo mv flutter /opt/ &&\
sudo ln -s /opt/flutter/bin/flutter /usr/local/bin/flutter &&\
sudo ln -s /opt/flutter/bin/dart /usr/local/bin/dart &&\
sudo dart pub global activate protoc_plugin &&\
sudo ln -s /root/.pub-cache/bin/protoc-gen-dart /usr/local/bin/
- name: Remove default github maven configuration
# This step is a workaround to avoid a decryption issue
run: sudo rm ~/.m2/settings.xml
- name: install npm
uses: actions/setup-node@v3
with:
node-version: '14'
- name: install docker linter
run: npm install -g dockerlint
- name: lint dockerfile
run: dockerlint Dockerfile
working-directory: playground/frontend
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
if: startsWith(github.ref, 'ref/tags/')
- name: Set Docker Tag
run: echo "DOCKERTAG=${GITHUB_SHA}" >> $GITHUB_ENV
- name: Set Docker Tag If Github Tag was trigger
run: echo "DOCKERTAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/')
- name: Setup GCP account
run: |
echo "${{ secrets.GCP_PLAYGROUND_SA_KEY }}" | base64 -d > /tmp/gcp_access.json
if: startsWith(github.ref, 'ref/tags/')
- name: Login to Docker Registry
run: cat /tmp/gcp_access.json | docker login -u _json_key --password-stdin https://${{ secrets.PLAYGROUND_REGISTRY_NAME }}
if: startsWith(github.ref, 'ref/tags/')
- name: Deploy Frontend Application
env:
GOOGLE_APPLICATION_CREDENTIALS: /tmp/gcp_access.json
run: ./gradlew playground:terraform:deployFrontend -Pdocker-tag=${{env.DOCKERTAG}} -Pproject_id=${{ secrets.GCP_PLAYGROUND_PROJECT_ID }} -Pproject_environment='beta'
if: startsWith(github.ref, 'refs/tags/')