From b7436375d5cb08e64c973aebf0b4d709b75a8b5e Mon Sep 17 00:00:00 2001 From: Igor Bari Date: Sat, 23 Mar 2024 07:18:16 +0000 Subject: [PATCH] use publish tools for pages deployment --- .github/workflows/build.yml | 28 +++++++++++----------------- TODO.md | 1 - scripts/pack_pages.py | 8 ++++++++ 3 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 scripts/pack_pages.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd19249..c3d7a52 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,32 +33,26 @@ jobs: if: ${{ github.event_name == 'push' }} steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 with: - node-version: 20 - - name: Get npm cache directory - id: npm-cache-dir - shell: bash - run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} - - uses: actions/cache@v4 - id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true' + fetch-depth: 0 + - uses: actions/setup-python@v4 with: - path: ${{ steps.npm-cache-dir.outputs.dir }} - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- + python-version: 3.12 + cache: pip + - uses: actions/setup-node@v4 + with: + cache: npm - run: npm ci + - run: pip install -r requirements.txt - run: npm run build:storybook - - name: Fix permissions - run: chmod -c -R +rX storybook-static/ - - name: Create archive - run: tar --dereference --hard-dereference --directory storybook-static/ -cvf "$RUNNER_TEMP/storybook-static.tar" . + - id: pack-test-pages + run: python scripts/pack_pages.py - name: Upload artifact id: upload-artifact uses: actions/upload-artifact@v4 with: name: github-pages - path: ${{ runner.temp }}/storybook-static.tar + path: ${{ steps.pack-test-pages.outputs.artifact }} retention-days: 30 deploy-storybook: runs-on: ubuntu-latest diff --git a/TODO.md b/TODO.md index e172ed9..5d4501e 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,3 @@ -- use publish tools for pages deployment - add badge - add button - add button group diff --git a/scripts/pack_pages.py b/scripts/pack_pages.py new file mode 100644 index 0000000..f8056b0 --- /dev/null +++ b/scripts/pack_pages.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +from pathlib import Path +from publish_tools import github_utils + +root_directory = Path(__file__).parent.parent + +github_utils.create_pages_artifact(directory=root_directory / 'storybook-static')