@@ -34,28 +34,25 @@ jobs:
3434 uses : aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
3535 - run : " echo '${{ github.sha }}' > REVISION"
3636 - name : ' Build Docker image'
37- uses : ' docker/build-push-action@1104d471370f9806843c095c1db02b5a90c5f8b6' # v3.3.1
38- with :
39- context : ' .'
40- load : true
41- tags : " sponsor-app-test:latest,${{ steps.login-ecr.outputs.registry }}/sponsor-app:${{ github.sha }},${{ steps.login-ecr.outputs.registry }}/sponsor-app:latest"
42- cache-from : type=gha
43- cache-to : type=gha,mode=max
44- - name : ' Push Docker image'
4537 uses : ' docker/build-push-action@1104d471370f9806843c095c1db02b5a90c5f8b6' # v3.3.1
4638 with :
4739 context : ' .'
4840 push : true
4941 tags : " ${{ steps.login-ecr.outputs.registry }}/sponsor-app:${{ github.sha }},${{ steps.login-ecr.outputs.registry }}/sponsor-app:latest"
42+ cache-from : type=gha
43+ cache-to : type=gha,mode=max
44+ # prevent manifest from being pushed instead of image on the specified tags for Lambda
45+ provenance : false
46+ sbom : false
5047
5148 deploy-prod :
5249 if : " ${{ success() && github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') }}"
5350 name : deploy-prod
54- needs : ["build"]
51+ needs : ["build", "test" ]
5552 permissions :
5653 contents : read
5754 id-token : write
58- runs-on : ubuntu-latest
55+ runs-on : ubuntu-slim
5956 concurrency :
6057 group : production
6158 cancel-in-progress : true
@@ -64,24 +61,20 @@ jobs:
6461 url : https://sponsorships.rubykaigi.org
6562 env :
6663 BUNDLE_GEMFILE : " ${{ github.workspace }}/deploy/Gemfile"
64+ IMAGE_URI : " ${{ needs.build.outputs.image-tag }}"
6765 steps :
68- - run : ' false' # disable temporarily
6966 - uses : actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
7067 - uses : ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
7168 with :
72- ruby-version : ' 3.2 '
69+ ruby-version : ' 3.4 '
7370 bundler-cache : true
74- - uses : hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
7571 - uses : aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
7672 with :
7773 aws-region : " us-west-2"
7874 role-skip-session-tagging : true
7975 role-to-assume : " arn:aws:iam::005216166247:role/GhaSponsorDeploy"
8076 mask-aws-account-id : false
81- - name : ' Run pre-deploy task'
82- run : " bundle exec hako oneshot --tag '${{ github.sha }}' ./deploy/hako/sponsor-app-batch.jsonnet bundle exec rake db:migrate"
83- - name : " Deploy sponsor-app-worker (ECS)"
84- run : " bundle exec hako deploy --tag '${{ github.sha }}' ./deploy/hako/sponsor-app-worker.jsonnet"
85- - name : " Deploy sponsor-app (App Runner)"
86- working-directory : ' ${{ github.workspace }}/tf/'
87- 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 : ' bundle exec ./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