Skip to content

Commit

Permalink
feat: build github action
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKheops committed Nov 29, 2023
1 parent a9abfa3 commit cd93a41
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 29 deletions.
43 changes: 19 additions & 24 deletions .github/workflows/publish.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
name: Chaindata Publish
name: Chaindata Fetch External

on:
# runs on each commit pushed to the `main` branch
# runs after each push to current branch
push:
branches: [main]
# runs at `30 minutes past the hour, every 6 hours`, starting at midnight UTC
schedule:
- cron: '30 0/6 * * *'
# can be run manually from the `Actions` tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
# Sets permissions of the GITHUB_TOKEN to allow pushing commits
permissions:
contents: read
pages: write
contents: write
id-token: write

concurrency:
Expand All @@ -23,19 +18,13 @@ concurrency:

jobs:
publish:
name: 'Build & publish chaindata to GitHub Pages'
name: 'Update data in dist folder'
timeout-minutes: 15
runs-on: ubuntu-latest

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Setup Node
Expand All @@ -54,12 +43,18 @@ jobs:
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build chaindata
- name: Fetch external
run: pnpm build
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: 'dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
- name: Commit changes
env:
CHAINDATA_CI_SUPERUSER_ACCESS_TOKEN: ${{ secrets.CHAINDATA_CI_SUPERUSER_ACCESS_TOKEN }}
run: |
git config --local --unset-all 'http.https://github.com/.extraheader'
git remote set-url origin https://x-access-token:${CHAINDATA_CI_SUPERUSER_ACCESS_TOKEN}@github.com/TalismanSociety/chaindata
git config user.name "chaindata-ci-superuser[bot]"
git config user.email "146698419+chaindata-ci-superuser[bot]@users.noreply.github.com"
if [[ "$(git status --porcelain=v2)" != "" ]]; then
git add .
git commit -m 'chore: updated externals'
git push
fi
8 changes: 3 additions & 5 deletions scripts/fetch-external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ import { cryptoWaitReady } from '@polkadot/util-crypto'
import { watCryptoWaitReady } from '@talismn/scale'
import startCase from 'lodash/startCase'

import { fetchExternalSteps } from './fetch-external/steps'
import { buildSteps } from './build/steps'
import { fetchExternalSteps } from './fetch-external/steps'

const steps: Array<() => Promise<void>> = [

// update local data
...fetchExternalSteps,

// update dist folder
...buildSteps

// update dist folder (use only for local testing, on github this will be run by the build script)
// ...buildSteps
]

await Promise.all([
Expand Down

0 comments on commit cd93a41

Please sign in to comment.