Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

S3 にデプロイするためのGitHub Actionを追加 #140

Open
wants to merge 4 commits into
base: dev-hamamatsu
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 11 additions & 24 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ name: production deploy
on:
push:
branches:
- master
- prod-hamamatsu

jobs:
deploy:
runs-on: ubuntu-18.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
ref: master
ref: prod-hamamatsu

- name: Setup Node
uses: actions/setup-node@v1
Expand All @@ -32,28 +30,17 @@ jobs:
- run: yarn run test
- run: yarn run generate:deploy --fail-on-page-error

- name: Temporarily disable "include administrators" branch protection
uses: benjefferies/branch-protection-bot@master
if: always()
- name: deploy to s3
uses: jakejarvis/s3-sync-action@master
with:
access-token: ${{ secrets.ACCESS_TOKEN }}
branch: production
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ''
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

とりあえず後から入れるつもりで空にしてるけど、これもSecretsにいれちゃえばいいかな?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

取り急ぎSecretsいじれる権限つけておきました〜
S3側の環境はもう少しお待ち下さいmm

AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_DEPLOY_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_DEPLOY_SECRET_ACCESS_KEY }}
AWS_REGION: 'ap-northeast-1' # optional: defaults to us-east-1
SOURCE_DIR: './dist'

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
publish_branch: production

- name: Enable "include administrators" branch protection
uses: benjefferies/branch-protection-bot@master
if: always() # Force to always run this step to ensure "include administrators" is always turned back on
with:
access-token: ${{ secrets.ACCESS_TOKEN }}
owner: tokyo-metropolitan-gov
repo: covid19
branch: production
- name: Create GitHub release
uses: rymndhng/release-on-push-action@master
with:
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ name: development deploy
on:
push:
branches:
- development
- dev-hamamatsu

jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
ref: dev-hamamatsu

- name: Setup Node
uses: actions/setup-node@v1
Expand All @@ -29,9 +31,13 @@ jobs:
- run: yarn run generate:dev --fail-on-page-error
- run: "echo \"User-agent: *\nDisallow: /\" > ./dist/robots.txt"

- name: deploy
uses: peaceiris/actions-gh-pages@v3
- name: deploy to s3
uses: jakejarvis/s3-sync-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
publish_branch: dev-pages
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ''
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_DEPLOY_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_DEPLOY_SECRET_ACCESS_KEY }}
AWS_REGION: 'ap-northeast-1' # optional: defaults to us-east-1
SOURCE_DIR: './dist'