s3 Conversion by @takehiro1111 #4
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: s3 Conversion | |
| run-name: ${{ github.workflow }} by @${{ github.actor }} | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| paths: | |
| - 'sam/s3-conversion/func/**' | |
| workflow_dispatch: | |
| env: | |
| AWS_REGION: ap-northeast-1 | |
| SLACK_ICON: sam/waf_rule/SAM_acorn_1.0dd761f4fca5f2e7007a323b74631ec71b03a92d.png | |
| IAM_ROLE_ARN: arn:aws:iam::685339645368:role/deploy-github-actions | |
| SLACK_CHANNEL_NAME: lambda_notify | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| sam: | |
| name: sam deploy | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: sam/s3-conversion | |
| timeout-minutes: 30 | |
| steps: # ref:https://docs.aws.amazon.com/ja_jp/serverless-application-model/latest/developerguide/deploying-using-github.html | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v4 | |
| - uses: actions/cache@v2 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| # SAMビルドのキャッシュ | |
| - uses: actions/cache@v2 | |
| with: | |
| path: .aws-sam/build | |
| key: ${{ runner.os }}-sam-build-${{ hashFiles('**/*.py') }} | |
| - uses: aws-actions/setup-sam@v2 | |
| - uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-region: ${{env.AWS_REGION}} | |
| role-to-assume: ${{ env.IAM_ROLE_ARN }} | |
| role-session-name: ${{ github.workflow }} | |
| #CloudTrailログ等の監査ログでどのセッションがどの操作を行ったのかを追跡するために設定。 | |
| - name: SAM Build | |
| run: sam build --use-container | |
| if: success() | |
| - name: SAM Deploy | |
| run: sam deploy --no-confirm-changeset --no-fail-on-empty-changeset | |
| if: success() | |
| - if: always() | |
| name: Slack Notification | |
| uses: rtCamp/[email protected] | |
| env: | |
| SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL_NAME }} | |
| SLACK_COLOR: ${{ job.status }} | |
| SLACK_USERNAME: SAM | |
| SLACK_MESSAGE: 'deploy success' | |
| SLACK_ICON: ${{ env.SLACK_ICON }} | |
| SLACK_TITLE: SAM Result🚀 | |
| SLACK_WEBHOOK: ${{ secrets.WEBHOOK_URL }} |