Skip to content

Commit

Permalink
Merge pull request #46 from YNUFes-tech/shion/github-actions-gae
Browse files Browse the repository at this point in the history
🔧 Deploy設定の追加
  • Loading branch information
Shion1305 authored Oct 21, 2023
2 parents 9789094 + f26c047 commit f4e9983
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/deploy-gae.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy to GAE
on:
push:
branches:
- "stg"
- "release"
jobs:
auto_deploy_gae:
permissions: write-all
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- name: Setup Node.js 18
uses: actions/setup-node@v2
with:
node-version: 18
- uses: actions/checkout@v2
- name: "Generate .env"
run: |
echo "${{ secrets.ENV_CONTENTS }}" > .env
- name: "Extract branch name"
id: branch-name
shell: bash
run: |
short_ref=${GITHUB_REF#refs/*/}
formatted_ref=$(echo "$short_ref" | tr '[:upper:]' '[:lower:]' | tr '/' '-')
echo "short_ref=${formatted_ref}" >> $GITHUB_ENV
- name: configure service name
run: |
if [[ "${{ github.short_ref }}" == "release" ]]; then
sed -i 's/{{service_name}}/tokiwa23/' app.yaml
elif [[ "${{ github.short_ref }}" == "stg" ]]; then
sed -i 's/{{service_name}}/tokiwa23-stg/' app.yaml
fi
# switch service name to configure deployment target appropriately
- name: Download events.json from external URL
run: |
curl "${{ secrets.EVENTS_DATA_URL }}" -o ./assets/data/events.json
- name: yarn install
run: yarn install
- name: yarn build
run: yarn build
- id: "auth"
uses: "google-github-actions/auth@v0"
with:
credentials_json: "${{ secrets.GCP_SA_KEY }}"
- name: "Deploy to App Engine"
id: "deploy"
uses: "google-github-actions/deploy-appengine@v0"
with:
deliverables: "app.yaml"
promote: true
2 changes: 1 addition & 1 deletion app.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
service: default
service: {{service_name}}
runtime: nodejs18

instance_class: F1
Expand Down

0 comments on commit f4e9983

Please sign in to comment.