From 91d3693e00aa6e947a64514126975d7ddd6e8a0e Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Thu, 15 Feb 2024 14:01:49 -0800 Subject: [PATCH] update github files --- .github/FUNDING.md | 3 ++ .github/dependabot.yml | 7 ++++ .github/workflows/ci.yml | 25 +++++++++++++ .github/workflows/release.yml | 70 +++++++++++++++++++++++++++++++++++ .github/workflows/update.yml | 47 +++++++++++++++++++++++ 5 files changed, 152 insertions(+) create mode 100644 .github/FUNDING.md create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/update.yml diff --git a/.github/FUNDING.md b/.github/FUNDING.md new file mode 100644 index 0000000..536da70 --- /dev/null +++ b/.github/FUNDING.md @@ -0,0 +1,3 @@ +tidelift: "npm/edgedriver" +open_collective: webdriverio +github: [christian-bromann,webdriverio] \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..04d0592 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: npm + directory: "/" + schedule: + interval: weekly + open-pull-requests-limit: 10 \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f9d93cb --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3c6d626 --- /dev/null +++ b/.github/workflows/release.yml @@ -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' }} \ No newline at end of file diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..750ab8f --- /dev/null +++ b/.github/workflows/update.yml @@ -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" \ No newline at end of file