Use rails-7.1.3.2 #168
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Review App | |
on: pull_request | |
env: | |
PROJECT_ID: jiikko | |
REGISTRY_HOST: asia-northeast1-docker.pkg.dev | |
SERVICE_NAME: pbm-cloud | |
REPOSITORY_NAME: pbm-cloud | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v3 | |
- id: "auth" | |
uses: "google-github-actions/auth@v0" | |
with: | |
credentials_json: "${{ secrets.GCP_CREDENTIALS }}" | |
- name: "Set up Cloud SDK" | |
uses: "google-github-actions/setup-gcloud@v0" | |
- name: "Use gcloud CLI" | |
run: | | |
gcloud auth list | |
gcloud info | |
- name: Authorize Docker push | |
run: gcloud auth configure-docker "${REGISTRY_HOST}" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
target: production | |
tags: ${{ env.REGISTRY_HOST }}/${{ env.PROJECT_ID }}/${{ env.REPOSITORY_NAME }}/web:pr-${{ github.event.number }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v3 | |
- id: "auth" | |
uses: "google-github-actions/auth@v0" | |
with: | |
credentials_json: "${{ secrets.GCP_CREDENTIALS }}" | |
- name: Deploy to Cloud Run | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} | |
REDISCLOUD_URL: ${{ secrets.REDISCLOUD_URL }} | |
GOOGLE_OAUTH2_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH2_CLIENT_ID }} | |
GOOGLE_OAUTH2_SECRET: ${{ secrets.GOOGLE_OAUTH2_SECRET }} | |
TWITCH_OAUTH2_CLIENT_ID: ${{ secrets.TWITCH_OAUTH2_CLIENT_ID }} | |
TWITCH_OAUTH2_SECRET: ${{ secrets.TWITCH_OAUTH2_SECRET }} | |
ACTION_CABLE_URL: ${{ vars.ACTION_CABLE_URL }} | |
run: |- | |
gcloud run deploy "$SERVICE_NAME" \ | |
--project="$PROJECT_ID" \ | |
--platform=managed \ | |
--image="${REGISTRY_HOST}/$PROJECT_ID/$REPOSITORY_NAME/web:pr-${{ github.event.number }}" \ | |
--region="asia-northeast1" \ | |
--tag=pr-${{ github.event.number }} \ | |
--set-env-vars="DATABASE_URL2=${DATABASE_URL}" \ | |
--set-env-vars="SECRET_KEY_BASE=${SECRET_KEY_BASE}" \ | |
--set-env-vars="REDISCLOUD_URL=${REDISCLOUD_URL}" \ | |
--set-env-vars="RAILS_ENV=production" \ | |
--set-env-vars="NEW_RELIC_LOG=stdout" \ | |
--set-env-vars="GOOGLE_OAUTH2_CLIENT_ID=${GOOGLE_OAUTH2_CLIENT_ID}" \ | |
--set-env-vars="GOOGLE_OAUTH2_SECRET=${GOOGLE_OAUTH2_SECRET}" \ | |
--set-env-vars="TWITCH_OAUTH2_CLIENT_ID=${TWITCH_OAUTH2_CLIENT_ID}" \ | |
--set-env-vars="TWITCH_OAUTH2_SECRET=${TWITCH_OAUTH2_SECRET}" \ | |
--set-env-vars="ACTION_CABLE_URL=${ACTION_CABLE_URL}" \ | |
--set-env-vars="DISABLE_ACTION_CABLE=1" \ | |
--no-traffic \ | |
--allow-unauthenticated | |
comment_pull_request: | |
needs: deploy | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Find Comment | |
uses: peter-evans/find-comment@v2 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: "7hrjn5ej3q-an.a.run.app/ がデプロイされました" | |
- name: Create or update comment | |
uses: peter-evans/create-or-update-comment@v3 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body: "https://pr-${{ github.event.number }}---pbm-cloud-7hrjn5ej3q-an.a.run.app/ がデプロイされました" | |
edit-mode: replace |