Skip to content

Sync

Sync #143

Workflow file for this run

name: Sync
on:
schedule:
- cron: 0 20 * * *
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 14
- run: npm install
- run: node download.js
- run: ls -la dist
if: ${{ always() }}
- name: upload files
if: ${{ always() }}
uses: actions/github-script@v2
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const fs = require('fs').promises;
console.log('environment:', process.versions);
const { repo: { owner, repo }, sha, ref } = context;
console.log('context:', { owner, repo, sha, ref });
const release = await github.repos.getReleaseByTag({
owner, repo,
tag: 'all'
});
for (let file of await fs.readdir('./dist')) {
console.log('uploading:', file);
await github.repos.uploadReleaseAsset({
owner, repo,
release_id: release.data.id,
name: file,
data: await fs.readFile(`./dist/${file}`)
});
}