From 57d73d15f56124da35c8b886a46d178b974a231e Mon Sep 17 00:00:00 2001 From: Nikita Rokotyan Date: Wed, 18 Dec 2024 09:28:45 -0800 Subject: [PATCH] Project: Host Storybook on Github pages --- .github/workflows/github_pages.yml | 55 ++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/github_pages.yml diff --git a/.github/workflows/github_pages.yml b/.github/workflows/github_pages.yml new file mode 100644 index 0000000..4333777 --- /dev/null +++ b/.github/workflows/github_pages.yml @@ -0,0 +1,55 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - publish + - next + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: npm-${{ hashFiles('package-lock.json') }} + restore-keys: npm- + - name: Build + uses: actions/setup-node@v4 + with: + node-version: '20.x' + - run: npm install -g npm@10 + - run: npm ci + - run: npm run build:storybook -- -o _site + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index 887f4a9..e15bbf6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ dist yarn.lock .eslintcache *storybook.log +storybook-static \ No newline at end of file