Skip to content

Commit

Permalink
chore: split up actions
Browse files Browse the repository at this point in the history
  • Loading branch information
peschee committed Oct 19, 2023
1 parent 8e8d89a commit ded47b2
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 100 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Test

# Prevent pull requests trigger duplicate checks for both [push] and [pull_request]
# @see https://github.com/orgs/community/discussions/26940
on:
push:
branches-ignore:
- 'dependabot/**' #avoid duplicates: only run the PR, not the push
- 'gh-pages' #github pages do not trigger all tests
tags-ignore:
- 'v*' #avoid rerun existing commit on release
pull_request:
branches:
- 'main'
- 'next'

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1
with:
egress-policy: audit

- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: '18'

# @see https://www.voorhoede.nl/en/blog/super-fast-npm-install-on-github-actions/
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
id: cache
with:
path: ./node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('package-lock.json') }}

- name: Install packages
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

- name: Run postinstall
if: steps.cache.outputs.cache-hit == 'true'
run: npm run --if-present postinstall && npm rebuild && npm run prepare --if-present

- name: Test
run: sudo npx playwright install-deps && npm run test:ci
1 change: 1 addition & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#
# Source repository: https://github.com/actions/dependency-review-action
name: 'Dependency Review'

on: [pull_request]

permissions:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Lint

# Prevent pull requests trigger duplicate checks for both [push] and [pull_request]
# @see https://github.com/orgs/community/discussions/26940
on:
push:
branches-ignore:
- 'dependabot/**' #avoid duplicates: only run the PR, not the push
- 'gh-pages' #github pages do not trigger all tests
tags-ignore:
- 'v*' #avoid rerun existing commit on release
pull_request:
branches:
- 'main'
- 'next'

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1
with:
egress-policy: audit

- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: '18'

# @see https://www.voorhoede.nl/en/blog/super-fast-npm-install-on-github-actions/
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
id: cache
with:
path: ./node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('package-lock.json') }}

- name: Install packages
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

- name: Run postinstall
if: steps.cache.outputs.cache-hit == 'true'
run: npm run --if-present postinstall && npm rebuild && npm run prepare --if-present

- name: Lint
run: npm run lint
84 changes: 0 additions & 84 deletions .github/workflows/pull-request.yml

This file was deleted.

31 changes: 15 additions & 16 deletions .github/workflows/gh-pages.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
name: Deploy to GitHub Pages
name: Test

# Prevent pull requests trigger duplicate checks for both [push] and [pull_request]
# @see https://github.com/orgs/community/discussions/26940
on:
workflow_dispatch:
push:
branches-ignore:
- 'dependabot/**' #avoid duplicates: only run the PR, not the push
- 'gh-pages' #github pages do not trigger all tests
tags-ignore:
- 'v*' #avoid rerun existing commit on release
pull_request:
branches:
- 'main'
- 'next'

permissions:
contents: read

jobs:
release:
permissions:
contents: write # for peaceiris/actions-gh-pages to push pages branch
name: Build & Deploy
# Prevents changesets action from creating a PR on forks
if: github.repository == 'inventage/web-components'
test:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
Expand Down Expand Up @@ -40,12 +46,5 @@ jobs:
if: steps.cache.outputs.cache-hit == 'true'
run: npm run --if-present postinstall && npm rebuild && npm run prepare --if-present

- name: Storybook Build
- name: Build
run: npm run storybook:build

- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./storybook-static
allow_empty_commit: true

0 comments on commit ded47b2

Please sign in to comment.