diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 32383f5..6d2eea8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run Type Check & Linters + name: Build, test & deploy runs-on: ubuntu-latest timeout-minutes: 10 @@ -17,6 +17,11 @@ jobs: with: fetch-depth: 0 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 20 + - name: Install dependencies run: npm ci @@ -35,9 +40,19 @@ jobs: - name: Build package run: npm run build - - name: Archive build artifacts + - name: Deploy Storybook if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' - uses: actions/upload-artifact@v3 + uses: bitovi/github-actions-storybook-to-github-pages@v1.0.2 with: - name: dist - path: dist + install_command: npm ci + build_command: npm run build-storybook + path: storybook-static + env: + GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} + + - name: Release + if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npx semantic-release diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 1303966..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Publish - -on: - workflow_run: - workflows: ['Main'] - types: - - completed - branches: - - main - - develop - -permissions: - contents: write - pages: write - id-token: write - pull-requests: write - issues: write - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 20 - - - name: Deploy Storybook - uses: bitovi/github-actions-storybook-to-github-pages@v1.0.2 - with: - install_command: npm ci - build_command: npm run build-storybook - path: storybook-static - env: - GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} - - - uses: actions/download-artifact@v3 - with: - name: dist - path: dist - - - name: Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npx semantic-release