provenance, sbom off #62
This file contains hidden or 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: 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@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2.10.0 | |
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | |
| #- uses: ruby/setup-ruby@v1 | |
| # with: | |
| # ruby-version: '3.1' | |
| # bundler-cache: true | |
| - uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1 | |
| 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@1104d471370f9806843c095c1db02b5a90c5f8b6' # v3.3.1 | |
| 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"] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: production | |
| cancel-in-progress: true | |
| environment: | |
| name: production | |
| url: https://sponsorships.rubykaigi.org | |
| env: | |
| BUNDLE_GEMFILE: "${{ github.workspace }}/deploy/Gemfile" | |
| steps: | |
| - run: 'false' # disable temporarily | |
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | |
| - uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0 | |
| with: | |
| ruby-version: '3.2' | |
| bundler-cache: true | |
| - uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 | |
| - uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1 | |
| 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 | |
| - name: 'Run pre-deploy task' | |
| run: "bundle exec hako oneshot --tag '${{ github.sha }}' ./deploy/hako/sponsor-app-batch.jsonnet bundle exec rake db:migrate" | |
| - name: "Deploy sponsor-app-worker (ECS)" | |
| run: "bundle exec hako deploy --tag '${{ github.sha }}' ./deploy/hako/sponsor-app-worker.jsonnet" | |
| - name: "Deploy sponsor-app (App Runner)" | |
| working-directory: '${{ github.workspace }}/tf/' | |
| run: "terraform init && terraform apply -target=aws_apprunner_service.prd -auto-approve" |