Skip to content

chore: lingui

chore: lingui #562

name: Deploy Release New
on:
push:
branches:
- master
- production
- staging
workflow_dispatch:
jobs:
bump_version:
name: Bump Version
runs-on: ubuntu-latest
outputs:
new_tag: ${{ steps.github_tag_action.outputs.new_tag }}
changelog: ${{ steps.github_tag_action.outputs.changelog }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Bump version and push tag
id: github_tag_action
uses: mathieudutour/[email protected]
with:
default_bump: minor
fetch_all_tags: true
github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: production, staging
deploy:
name: Deploy Release
runs-on: ubuntu-latest
needs: bump_version
if: ${{ needs.bump_version.outputs.new_tag != null }}
steps:
- name: Pre-checks - Env is Dev
run: |
echo "ENV=development" >> $GITHUB_ENV
echo "SECRET_NAME=DEV_ENV" >> $GITHUB_ENV
- name: Pre-checks - Env is QA
if: ${{ endsWith(github.ref, '/staging') }}
run: |
echo "ENV=staging" >> $GITHUB_ENV
echo "SECRET_NAME=STAGING_ENV" >> $GITHUB_ENV
- name: Pre-checks - Env is PRODUCTION
if: ${{ endsWith(github.ref, '/production') }}
run: |
echo "ENV=production" >> $GITHUB_ENV
echo "SECRET_NAME=PRODUCTION_ENV" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Prepare .env and add secrets
run: |
env_name="${{ env.ENV }}"
dotenv_name="env/$env_name"
secret_name="${{ env.SECRET_NAME }}"
echo $env_name
cat env/shared
cat $dotenv_name
echo "setting environment from $dotenv_name"
cp env/shared .env
cat $dotenv_name >> .env
echo "setting environment from secrets file: $secret_name"
echo "${{ secrets.SHARED_ENV }}" >> .env
echo "${{ secrets[env.SECRET_NAME] }}" >> .env
echo "copying settings to GITHUB_ENV"
cat .env >> $GITHUB_ENV
- name: Load node v16
uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: yarn
- name: Install dependencies
uses: borales/actions-yarn@v4
with:
cmd: install #yarn install
- name: Build app
run: yarn build
# Pinning
- name: Pin via web3 storage (Upload to web3 storage)
id: web3
uses: web3-storage/add-to-web3@v1
with:
web3_token: ${{ secrets.WEB3_STORAGE }}
path_to_add: './dist'
- name: Display pin address
run: |
echo published as ${{ steps.web3.outputs.url }}
echo cid ${{ steps.web3.outputs.cid }}
# DNS
- name: Update DNS with new IPFS hash
env:
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
RECORD_DOMAIN: ${{ env.CLOUDFLARE_DOMAIN }}
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
id: dnslink
uses: GoodDollar/[email protected]
with:
cid: ${{ steps.web3.outputs.cid }}
# GitHub release with links
- name: Create GitHub Release with tag ${{ needs.bump_version.outputs.new_tag }}
if: ${{ contains(github.ref, 'production') }}
id: create_release
uses: ncipollo/[email protected]
env:
DEPLOY_ADDR: '${{ env.SUBDOMAIN }}.${{ env.CLOUDFLARE_DOMAIN }}'
with:
tag: ${{ needs.bump_version.outputs.new_tag }}
name: ${{ needs.bump_version.outputs.new_tag }}
token: ${{ secrets.GITHUB_TOKEN }}
body: |
IPFS hash of the deployment:
- CID: `${{ steps.web3.outputs.cid }}`
The latest release is always accessible via our alias to the Cloudflare IPFS gateway at [${{ env.DEPLOY_ADDR }}](https://${{ env.DEPLOY_ADDR }}/).
IPFS gateways:
- ${{ steps.web3.outputs.url }}
- https://${{ steps.web3.outputs.cid }}.ipfs.dweb.link/
- https://${{ steps.web3.outputs.cid }}.ipfs.cf-ipfs.com/
- https://gateway.pinata.cloud/ipfs/${{ steps.web3.outputs.cid }}/
- https://cloudflare-ipfs.com/ipfs/${{ steps.web3.outputs.cid }}/
- https://ipfs.io/ipfs/${{ steps.web3.outputs.cid }}/
${{ needs.bump_version.outputs.changelog }}