Release - Mainnet #43
This file contains 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: Release - Mainnet | |
on: | |
workflow_dispatch: | |
inputs: | |
bumpType: | |
description: 'Bump version' | |
required: true | |
default: 'patch' | |
type: choice | |
options: | |
- 'patch' | |
- 'minor' | |
- 'major' | |
jobs: | |
bump: | |
runs-on: ubuntu-latest | |
name: 'Bump version' | |
outputs: | |
newTag: ${{ steps.version-bump.outputs.newTag }} | |
environment: | |
name: mainnet | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'yarn' | |
- name: Automated Version Bump | |
id: version-bump | |
uses: phips28/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
with: | |
version-type: ${{ inputs.bumpType }} | |
tag-prefix: 'v' | |
target-branch: 'main' | |
commit-message: 'CI: bumps version to {{version}}' | |
bump-policy: 'last-commit' | |
aws: | |
runs-on: ubuntu-latest | |
name: 'Publish to AWS' | |
needs: [bump] | |
environment: | |
name: mainnet | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Tests pass | |
run: yarn test | |
- name: Build the app | |
env: | |
VERSION: ${{ needs.bump.outputs.newTag }} | |
run: yarn build | |
- name: Configure AWS | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Deploy app build to S3 bucket | |
run: aws s3 sync ./build/ s3://$BUCKET_NAME/tokens-list | |
env: | |
BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }} | |
- name: Run Cache Invalidation | |
run: aws cloudfront create-invalidation --distribution-id $CDN_DISTRIBUTION_ID --paths /\* | |
env: | |
CDN_DISTRIBUTION_ID: ${{ secrets.AWS_CDN_DISTRIBUTION_ID }} | |
ipfs: | |
runs-on: ubuntu-latest | |
name: 'Publish to IPFS' | |
needs: [bump] | |
environment: | |
name: mainnet | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Tests pass | |
run: yarn test | |
- name: Build the app | |
env: | |
VERSION: ${{ needs.bump.outputs.newTag }} | |
run: yarn build | |
- name: Pin to IPFS | |
id: upload | |
uses: anantaramdas/[email protected] | |
with: | |
pin-name: JediSwap Default Token List ${{ needs.bump.outputs.newTag }} | |
path: "./build/jediswap-default.tokenlist.json" | |
pinata-api-key: ${{ secrets.PINATA_API_KEY }} | |
pinata-secret-api-key: ${{ secrets.PINATA_API_SECRET_KEY }} | |
# TODO: uncomment after updating secrets | |
# - name: Check Concatenation | |
# run: echo "dnslink=/ipfs/${{ steps.upload.outputs.hash }}" | |
# | |
# - name: Update DNS with new IPFS hash | |
# uses: Roosterfish/aws-route53-record-set-action@master | |
# with: | |
# aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
# aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# aws_route53_hosted_zone_id: ${{ secrets.AWS_ROUTE53_HOSTED_ZONE_ID }} | |
# aws_route53_rr_action: "UPSERT" | |
# aws_route53_rr_name: "_dnslink.tokens.jediswap.xyz" | |
# aws_route53_rr_type: "TXT" | |
# aws_route53_rr_ttl: "300" | |
# aws_route53_rr_value: '"dnslink=/ipfs/${{ steps.upload.outputs.hash }}"' |