Skip to content

Scrape

Scrape #20850

Workflow file for this run

name: Scrape
on:
workflow_dispatch:
schedule:
- cron: '0 * * * *'
jobs:
scrape:
runs-on: ubuntu-latest
strategy:
matrix:
channel: ['stable', 'ptb', 'canary']
env:
OUTPUT_DIRECTORY: ${{ github.workspace }}/result
PUBLISH_WORK_DIRECTORY: ${{ github.workspace }}/publish
steps:
- name: Checkout scraper
uses: actions/checkout@v3
- name: Checkout result
uses: actions/checkout@v3
with:
ref: ${{ matrix.channel }}
path: ${{ env.OUTPUT_DIRECTORY }}
continue-on-error: true
- name: Copy result repository to publish work directory
run: |
mkdir ${{ env.PUBLISH_WORK_DIRECTORY }}
cp -r ${{ env.OUTPUT_DIRECTORY }}/.git ${{ env.PUBLISH_WORK_DIRECTORY }}
- name: Set up node
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
uses: bahmutov/npm-install@HEAD
- name: Scrape
run: yarn scrape --token ${{ secrets.ACCOUNT_TOKEN }} --channel ${{ matrix.channel }} --output-directory ${{ env.OUTPUT_DIRECTORY }}
- name: Get result build
id: build
uses: notiz-dev/github-action-json-property@release
with:
path: ${{ env.OUTPUT_DIRECTORY }}/manifest.json
prop_path: 'build'
- name: Get result version hash
id: version-hash
uses: notiz-dev/github-action-json-property@release
with:
path: ${{ env.OUTPUT_DIRECTORY }}/manifest.json
prop_path: 'versionHash'
- name: Publish
if: success()
run: |
cd ${{ env.PUBLISH_WORK_DIRECTORY }}
git config user.name "Jaime Filho"
git config user.email "[email protected]"
cp -a ${{ env.OUTPUT_DIRECTORY }}/* ${{ env.PUBLISH_WORK_DIRECTORY }}
git add .
git diff-index --quiet HEAD || git commit -m "${{ matrix.channel }} - ${{ steps.version-hash.outputs.prop }} (build ${{ steps.build.outputs.prop }})"
git push origin ${{ matrix.channel }}