From 9b663bc2782d54e533cb9cad347ee22a6833c2a2 Mon Sep 17 00:00:00 2001 From: Seonglae Cho Date: Tue, 10 Jun 2025 23:30:22 +0100 Subject: [PATCH] chore: use CLI push for monthly export --- .github/workflows/monthly-export.yml | 45 ++++++++++++++++++++++++++++ .github/workflows/tag-release.yml | 29 ++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 .github/workflows/monthly-export.yml create mode 100644 .github/workflows/tag-release.yml diff --git a/.github/workflows/monthly-export.yml b/.github/workflows/monthly-export.yml new file mode 100644 index 00000000..6959c699 --- /dev/null +++ b/.github/workflows/monthly-export.yml @@ -0,0 +1,45 @@ +name: Monthly Export + +on: + schedule: + - cron: '0 0 28-31 * *' + workflow_dispatch: + +jobs: + export: + if: github.repository == 'texonom/notion-node' + runs-on: ubuntu-latest + + steps: + - name: check last day + id: last + run: | + if [ $(date -d tomorrow +"%d") = "01" ]; then + echo "run=true" >> "$GITHUB_OUTPUT" + else + echo "run=false" >> "$GITHUB_OUTPUT" + fi + + - uses: actions/checkout@v4 + if: steps.last.outputs.run == 'true' + + - name: Install Node.js + if: steps.last.outputs.run == 'true' + uses: actions/setup-node@v4 + with: + node-version: 22.16.0 + + - name: Install dependencies + if: steps.last.outputs.run == 'true' + run: | + npm i -g pnpm + pnpm i --frozen-lockfile + + - name: Export from Notion + if: steps.last.outputs.run == 'true' + env: + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} + PAGE_ID: ${{ secrets.NOTION_PAGE_ID }} + run: | + pnpm tsx packages/cli/src/main.ts export -p "$PAGE_ID" -r -l -t "$NOTION_TOKEN" -u + diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml new file mode 100644 index 00000000..19ca661b --- /dev/null +++ b/.github/workflows/tag-release.yml @@ -0,0 +1,29 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + run: + if: github.repository == 'texonom/notion-node' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 22.16.0 + + - name: Install dependencies + run: | + npm i -g pnpm + pnpm i --frozen-lockfile + + - name: Run release script + run: pnpm tsx release.ts --version=${{ github.ref_name }}