Skip to content

Commit

Permalink
update github files
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Feb 15, 2024
1 parent 6f744b5 commit 91d3693
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tidelift: "npm/edgedriver"
open_collective: webdriverio
github: [christian-bromann,webdriverio]
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 💚 Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: 🚧 Install Dependencies
run: npm ci
- name: 📦 Build
run: npm run build
- name: 🧪 Run Tests
uses: GabrielBB/xvfb-action@v1
with:
run: npm test
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Manual NPM Publish

on:
workflow_dispatch:
inputs:
releaseType:
description: "Release type - major, minor or patch"
required: true
type: choice
default: "patch"
options:
- patch
- minor
- major
distTag:
description: 'NPM tag (e.g. use "next" to release a test version)'
required: true
default: 'latest'
preRelease:
description: If latest release was a pre-release (e.g. X.X.X-alpha.0) and you want to push another one, pick "yes"
required: true
type: choice
default: "no"
options:
- "yes"
- "no"

env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
ref: 'main'
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- name: NPM Setup
run: |
npm set registry "https://registry.npmjs.org/"
npm set //registry.npmjs.org/:_authToken $NPM_TOKEN
npm whoami
- name: Git Setup
run: |
git config --global user.email "bot@webdriver.io"
git config --global user.name "WebdriverIO Release Bot"
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
- name: Release
run: npx release-it ${{github.event.inputs.releaseType}} --github.release --ci --npm.skipChecks --no-git.requireCleanWorkingDir --npm.tag=${{github.event.inputs.distTag}}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.event.inputs.preRelease == 'no' }}
- name: Pre-Release
run: npx release-it ${{github.event.inputs.releaseType}} --github.release --ci --npm.skipChecks --no-git.requireCleanWorkingDir --preRelease=alpha --github.preRelease --npm.tag=next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.event.inputs.preRelease == 'yes' }}
47 changes: 47 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# this workflow merges requests from Dependabot if tests are passing
# ref https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
# and https://github.com/dependabot/fetch-metadata
name: Auto-merge

# `pull_request_target` means this uses code in the base branch, not the PR.
on: pull_request_target

# Dependabot PRs' tokens have read permissions by default and thus we must enable write permissions.
permissions:
contents: write
pull-requests: write

jobs:
dependencies:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'

steps:
- name: Fetch PR metadata
id: metadata
uses: dependabot/fetch-metadata@v1.6.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Wait for PR CI
# Don't merge updates to GitHub Actions versions automatically.
# (Some repos may wish to limit by version range (major/minor/patch), or scope (dep vs dev-dep), too.)
if: contains(steps.metadata.outputs.package-ecosystem, 'npm')
uses: lewagon/wait-on-check-action@v1.3.3
with:
ref: ${{ github.event.pull_request.head.sha }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 30 # seconds
running-workflow-name: dependencies # wait for all checks except this one
allowed-conclusions: success # all other checks must pass, being skipped or cancelled is not sufficient

- name: Auto-merge dependabot PRs
# Don't merge updates to GitHub Actions versions automatically.
# (Some repos may wish to limit by version range (major/minor/patch), or scope (dep vs dev-dep), too.)
if: contains(steps.metadata.outputs.package-ecosystem, 'npm')
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The "auto" flag will only merge once all of the target branch's required checks
# are met. Configure those in the "branch protection" settings for each repo.
run: gh pr merge --auto --squash "$PR_URL"

0 comments on commit 91d3693

Please sign in to comment.