Deploy to S3 #97
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: Deploy to S3 | |
| on: | |
| release: | |
| types: [created] | |
| workflow_run: | |
| workflows: ["Update Permit Info"] | |
| types: | |
| - completed | |
| # Allow manual trigger | |
| workflow_dispatch: | |
| # Required for authenticating with AWS IAM | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1 | |
| with: | |
| role-to-assume: arn:aws:iam::693696263829:role/token-list-github-action-role | |
| role-session-name: githubactionsession | |
| aws-region: eu-central-1 | |
| - name: Upload to S3 | |
| run: | | |
| aws s3 cp src/public/CowSwap.json s3://files.cow.fi/tokens/CowSwap.json | |
| aws s3 sync src/public s3://files.cow.fi/token-lists --delete | |
| - name: Invalidate CloudFront cache | |
| run: | | |
| aws cloudfront create-invalidation \ | |
| --distribution-id $DIST_ID \ | |
| --paths "/tokens/*" "/token-lists/*" | |
| env: | |
| DIST_ID: ${{ secrets.DISTRIBUTION }} |