-
-
Save noman-land/2a5b8fd572995dfcc18c4a4cf77dd6da to your computer and use it in GitHub Desktop.
Github actions deploy to IPFS and update Cloudflare TXT _dnslink subdomain example
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: | |
- master | |
jobs: | |
set_environment: | |
outputs: | |
env_name: ${{ steps.setenv.outputs.env_name }} | |
runs-on: ubuntu-latest | |
steps: | |
- id: setenv | |
run: echo "::set-output name=env_name::${GITHUB_REF#refs/heads/}" | |
build: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: set_environment | |
environment: | |
name: ${{ needs.set_environment.outputs.env_name }} | |
defaults: | |
run: | |
working-directory: ./src | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
registry-url: https://registry.npmjs.org | |
- name: Install node dependencies | |
run: npm install | |
- name: Build the app | |
run: npm run build | |
- name: Pin to IPFS on Pinata | |
id: upload | |
uses: anantaramdas/[email protected] | |
with: | |
pin-name: ${{ github.sha }} | |
path: './build' | |
verbose: false | |
pinata-api-key: ${{ secrets.PINATA_API_KEY }} | |
pinata-secret-api-key: ${{ secrets.PINATA_SECRET_API_KEY }} | |
- name: Update CloudFlare DNS with new IPFS hash | |
env: | |
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} | |
RECORD_DOMAIN: 'example.com' | |
RECORD_NAME: '_dnslink' | |
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} | |
uses: textileio/cloudflare-update-dnslink@v2 | |
with: | |
cid: ${{ steps.upload.outputs.hash }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment