Skip to content

Merge pull request #128 from ruby-no-kai/root-page #118

Merge pull request #128 from ruby-no-kai/root-page

Merge pull request #128 from ruby-no-kai/root-page #118

Workflow file for this run

name: ci
on:
push:
branches:
- master
- main
- test
jobs:
test:
uses: ./.github/workflows/_test.yml
build:
name: build
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
outputs:
image-tag: "${{ steps.login-ecr.outputs.registry }}/sponsor-app:${{ github.sha }}"
steps:
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
#- uses: ruby/setup-ruby@v1
# with:
# ruby-version: '3.1'
# bundler-cache: true
- uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0
with:
aws-region: "us-west-2"
role-skip-session-tagging: true
role-to-assume: "arn:aws:iam::005216166247:role/GhaDockerPush"
mask-aws-account-id: false
- id: login-ecr
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
- run: "echo '${{ github.sha }}' > REVISION"
- name: 'Build Docker image'
uses: 'docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8' # v6.19.2
with:
context: '.'
push: true
tags: "${{ steps.login-ecr.outputs.registry }}/sponsor-app:${{ github.sha }},${{ steps.login-ecr.outputs.registry }}/sponsor-app:latest"
cache-from: type=gha
cache-to: type=gha,mode=max
# prevent manifest from being pushed instead of image on the specified tags for Lambda
provenance: false
sbom: false
deploy-prod:
if: "${{ success() && github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') }}"
name: deploy-prod
needs: ["build", "test"]
permissions:
contents: read
id-token: write
runs-on: ubuntu-slim
concurrency:
group: production
cancel-in-progress: true
environment:
name: production
url: https://sponsorships.rubykaigi.org
env:
BUNDLE_GEMFILE: "${{ github.workspace }}/deploy/Gemfile"
IMAGE_URI: "${{ needs.build.outputs.image-tag }}"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ruby/setup-ruby@09a7688d3b55cf0e976497ff046b70949eeaccfd # v1.288.0
with:
ruby-version: '3.4'
bundler-cache: true
- uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0
with:
aws-region: "us-west-2"
role-skip-session-tagging: true
role-to-assume: "arn:aws:iam::005216166247:role/GhaSponsorDeploy"
mask-aws-account-id: false
- run: 'aws lambda update-function-code --function-name sponsor-app-runner-prd --image-uri "$IMAGE_URI" && aws lambda wait function-updated --function-name sponsor-app-runner-prd'
- run: 'bundle exec ./deploy/lambrunner.rb sponsor-app-runner-prd bundle exec rake db:migrate'
- run: 'aws lambda update-function-code --function-name sponsor-app-lambdakiq-prd --image-uri "$IMAGE_URI" && aws lambda wait function-updated --function-name sponsor-app-lambdakiq-prd'
- run: 'aws lambda update-function-code --function-name sponsor-app-web-prd --image-uri "$IMAGE_URI" && aws lambda wait function-updated --function-name sponsor-app-web-prd'
# because getsentry/action-release requires Docker runtime
notify-release-prod:
name: notify-release-prod
needs: ["deploy-prod"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: getsentry/action-release@dab6548b3c03c4717878099e43782cf5be654289 # v3.5.0
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: rubykaigi
SENTRY_PROJECT: sponsor-app
with:
environment: production