From 407eec99d678687004365169a6e3e0696aa66a08 Mon Sep 17 00:00:00 2001 From: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com> Date: Tue, 1 Nov 2022 18:52:30 +0530 Subject: [PATCH] build: update `.github` workflow(s) Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com> --- .github/dependabot.yml | 20 ++++++++++---- .github/semantic.yml | 5 ---- .github/workflows/ci.yml | 40 ++++++++-------------------- .github/workflows/demo.yml | 39 +++++++++++++++++++++++++++ .github/workflows/deploy-gh.yml | 38 -------------------------- .github/workflows/lint-pr.yml | 28 +++++++++++++++++++ .github/workflows/shipjs-trigger.yml | 16 +++++------ 7 files changed, 99 insertions(+), 87 deletions(-) delete mode 100644 .github/semantic.yml create mode 100644 .github/workflows/demo.yml delete mode 100644 .github/workflows/deploy-gh.yml create mode 100644 .github/workflows/lint-pr.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 25b62812..1957e034 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,8 +1,3 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - version: 2 updates: # Fetch and update latest `npm` packages @@ -20,6 +15,21 @@ updates: prefix: fix prefix-development: chore include: scope +# Fetch and update latest `npm` packages +- package-ecosystem: npm + directory: '/example' + schedule: + interval: daily + time: '00:00' + open-pull-requests-limit: 10 + reviewers: + - vinayakkulkarni + assignees: + - vinayakkulkarni + commit-message: + prefix: fix + prefix-development: chore + include: scope # Fetch and update latest `github-actions` pkgs - package-ecosystem: github-actions directory: '/' diff --git a/.github/semantic.yml b/.github/semantic.yml deleted file mode 100644 index 379ce534..00000000 --- a/.github/semantic.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Always validate the PR title AND all the commits -titleAndCommits: true -# Allows use of Merge commits (eg on github: "Merge branch 'master' into feature/ride-unicorns") -# this is only relevant when using commitsOnly: true (or titleAndCommits: true) -allowMergeCommits: true \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6fb7e71..1e79a82a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,40 +1,29 @@ -name: ci +name: 'Continuous Integration' on: push: branches: - main - - next - pull_request_target: + - legacy + pull_request: branches: - main - - next + - legacy permissions: checks: write contents: read -concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} - cancel-in-progress: true - jobs: ci: - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - node: [16] - + runs-on: ubuntu-latest steps: - - name: Check out repository ✨ - if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }} + - name: Check out repository ✨ (non dependabot) + if: ${{ github.actor != 'dependabot[bot]' }} uses: actions/checkout@v3 - name: Check out repository 🎉 (dependabot) - if: ${{ github.event_name == 'pull_request_target' }} + if: ${{ github.actor == 'dependabot[bot]' }} uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} @@ -42,16 +31,12 @@ jobs: - name: Setup node env 📦 uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node }} + node-version: 'current' check-latest: true - registry-url: https://registry.npmjs.org - cache: 'npm' - - - name: Upgrade npm 🎉 - run: npm install -g npm@latest + cache: 'npm' - name: Install dependencies 🚀 - run: npm ci --prefer-offline --no-audit --no-optional + run: npm ci --prefer-offline --no-audit --omit=optional - name: Run linter(s) 👀 uses: wearerequired/lint-action@v2 @@ -69,8 +54,5 @@ jobs: prettier: true prettier_extensions: js,ts,vue - - name: Run tests 🏁 - run: npm test - - name: Build the package 🎉 run: npm run build diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml new file mode 100644 index 00000000..e69fa5a5 --- /dev/null +++ b/.github/workflows/demo.yml @@ -0,0 +1,39 @@ +name: 'Deploy to Pages' + +on: + push: + branches: + - main + +jobs: + deploy-demo: + runs-on: ubuntu-latest + defaults: + run: + working-directory: './example/' + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Setup node env 📦 + uses: actions/setup-node@v3 + with: + node-version: 'current' + check-latest: true + cache: 'npm' + cache-dependency-path: '**/package-lock.json' + + - name: Install dependencies 🚀 + run: npm ci --prefer-offline --no-audit --omit=optional + + - name: Run build 🏁 + run: npm run build + + - name: Deploy to GitHub Pages 🚀 + uses: peaceiris/actions-gh-pages@v3.9.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./example/dist + cname: v-image.netlify.app diff --git a/.github/workflows/deploy-gh.yml b/.github/workflows/deploy-gh.yml deleted file mode 100644 index e8b62ee3..00000000 --- a/.github/workflows/deploy-gh.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Deploy - -on: - push: - branches: - - main - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Setup node env 📦 - uses: actions/setup-node@v3 - with: - node-version: 16 - registry-url: 'https://registry.npmjs.org' - check-latest: true - cache: 'npm' - - - name: Upgrade npm ✨ - run: npm i -g npm@latest - - - name: Clean Install dependencies 🛠 - run: npm ci --no-audit --prefer-offline - - - name: Generate the static site ⚡️ - run: npm run build-storybook - - - name: Deploy to GitHub Pages 🚀 - uses: peaceiris/actions-gh-pages@v3.8.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./static/storybook diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml new file mode 100644 index 00000000..aa2f1bb6 --- /dev/null +++ b/.github/workflows/lint-pr.yml @@ -0,0 +1,28 @@ +name: 'Lint PR' + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + validate-pr-title: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + check-sign-off: + if: startsWith(github.head_ref, 'releases/v') == false + name: Write comment if unsigned commits found + env: + FORCE_COLOR: 1 + runs-on: ubuntu-latest + steps: + - uses: live627/check-pr-signoff-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/shipjs-trigger.yml b/.github/workflows/shipjs-trigger.yml index 78dedd37..4d2dbf29 100644 --- a/.github/workflows/shipjs-trigger.yml +++ b/.github/workflows/shipjs-trigger.yml @@ -9,27 +9,23 @@ jobs: runs-on: ubuntu-latest if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/v') steps: - - name: Checkout 🛎️ + - name: Checkout code 🛎 uses: actions/checkout@v3 with: fetch-depth: 0 ref: main - - name: Setup node env 📦 + - name: Setup node environment 📦 uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 'current' check-latest: true - registry-url: https://registry.npmjs.org cache: 'npm' - - name: Upgrade npm 🎉 - run: npm install -g npm@latest + - name: Install dependencies 🚀 + run: npm ci --prefer-offline --no-audit --omit=optional - - name: Install dependencies 👨🏻‍💻 - run: npm ci --prefer-offline --no-audit - - - name: Perform a new release 🚨 + - name: Trigger a release 🥳 run: npx shipjs trigger env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}