Skip to content

Commit 0e2f184

Browse files
committed
enable deploy to Lambda
1 parent 944e1eb commit 0e2f184

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ jobs:
4646
sbom: false
4747

4848
deploy-prod:
49-
if: "${{ success() && github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') }}"
49+
if: "${{ success() && github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/test') }}"
5050
name: deploy-prod
51-
needs: ["build"]
51+
needs: ["build", "test"]
5252
permissions:
5353
contents: read
5454
id-token: write
55-
runs-on: ubuntu-latest
55+
runs-on: ubuntu-slim
5656
concurrency:
5757
group: production
5858
cancel-in-progress: true
@@ -61,24 +61,20 @@ jobs:
6161
url: https://sponsorships.rubykaigi.org
6262
env:
6363
BUNDLE_GEMFILE: "${{ github.workspace }}/deploy/Gemfile"
64+
IMAGE_URI: "${{ needs.build.outputs.image-tag }}"
6465
steps:
65-
- run: 'false' # disable temporarily
6666
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
6767
- uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
6868
with:
69-
ruby-version: '3.2'
69+
ruby-version: '3.4'
7070
bundler-cache: true
71-
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
7271
- uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
7372
with:
7473
aws-region: "us-west-2"
7574
role-skip-session-tagging: true
7675
role-to-assume: "arn:aws:iam::005216166247:role/GhaSponsorDeploy"
7776
mask-aws-account-id: false
78-
- name: 'Run pre-deploy task'
79-
run: "bundle exec hako oneshot --tag '${{ github.sha }}' ./deploy/hako/sponsor-app-batch.jsonnet bundle exec rake db:migrate"
80-
- name: "Deploy sponsor-app-worker (ECS)"
81-
run: "bundle exec hako deploy --tag '${{ github.sha }}' ./deploy/hako/sponsor-app-worker.jsonnet"
82-
- name: "Deploy sponsor-app (App Runner)"
83-
working-directory: '${{ github.workspace }}/tf/'
84-
run: "terraform init && terraform apply -target=aws_apprunner_service.prd -auto-approve"
77+
- 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'
78+
- run: './deploy/lambrunner.rb sponsor-app-runner-prd bundle exec rake db:migrate'
79+
- 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'
80+
- 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'

0 commit comments

Comments
 (0)