run deploy on main push (#38) #19
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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: # manual trigger | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: | |
group: npm-deploy | |
environment: | |
name: release | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "16" | |
- name: Load NPM secret | |
uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 | |
with: | |
# Export loaded secrets as environment variables | |
export-env: true | |
env: | |
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} | |
# You may need to change this to your vault name and secret name | |
# Refer to it by calling env.NPM_TOKEN | |
# This token is also limited by IP to ONLY work on the runner | |
NPM_TOKEN: op://npm-deploy/npm-runner-token/secret | |
- name: Install dependencies | |
run: yarn install | |
- name: Tests pass | |
run: yarn test | |
- name: Build list | |
run: yarn build | |
- name: Publish to NPM | |
uses: JS-DevTools/npm-publish@18351461ae08dde235c0ccee0633ec905f0b9a52 | |
with: | |
token: ${{ env.NPM_TOKEN }} | |
- name: Load Web 3 deploy secrets | |
uses: 1password/load-secrets-action@d1a4e73495bde3551cf63f6c048588b8f734e21d | |
with: | |
# Export loaded secrets as environment variables | |
export-env: true | |
env: | |
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_WEB3_VAULT_TOKEN }} | |
CLOUDFLARE_TOKEN: op://web3-deploy-vault/web3-edit-token/token | |
- name: Pin to IPFS | |
id: upload | |
uses: anantaramdas/ipfs-pinata-deploy-action@a551f37c17ec3961df7c3ad52e1cd266dfd3d7e7 | |
with: | |
pin-name: Uniswap Extended Token List | |
path: "build/uniswap-extended.tokenlist.json" | |
pinata-api-key: ${{ secrets.PINATA_API_KEY }} | |
pinata-secret-api-key: ${{ secrets.PINATA_API_SECRET_KEY }} | |
- name: Update DNS with new IPFS hash | |
env: | |
CLOUDFLARE_TOKEN: ${{ env.CLOUDFLARE_TOKEN }} | |
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} | |
CLOUDFLARE_GATEWAY_ID: ${{ secrets.CLOUDFLARE_GATEWAY_ID }} | |
uses: Uniswap/cloudflare-update-web3-gateway@b3205288b1c6d0acb63fa3bd8fb686c72a9e3f3e | |
with: | |
cid: ${{ steps.upload.outputs.hash }} | |