Skip to content

Commit

Permalink
Replace release scripts with GHA (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann authored Oct 18, 2021
1 parent 27ae143 commit 7bef031
Show file tree
Hide file tree
Showing 7 changed files with 2,957 additions and 164 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Manual Docker Publish

on:
workflow_dispatch:
inputs:
releaseType:
description: 'Release type - major, minor or patch'
required: true
default: 'patch'
distTag:
description: 'NPM tag (e.g. use "next" to release a test version)'
required: true
default: 'latest'

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

jobs:
authorize:
runs-on: ubuntu-latest
steps:
- uses: octokit/[email protected]
with:
route: GET /orgs/:organisation/teams/:team/memberships/${{ github.actor }}
team: technical-steering-committee
organisation: webdriverio
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
release:
needs: [authorize]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: 'main'
fetch-depth: 0

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
vvoyer/selenium-standalone
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
# always push given this workflow is triggered manually
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
54 changes: 54 additions & 0 deletions .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Manual NPM Publish

on:
workflow_dispatch:
inputs:
releaseType:
description: 'Release type - major, minor or patch'
required: true
default: 'patch'
distTag:
description: 'NPM tag (e.g. use "next" to release a test version)'
required: true
default: 'latest'

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

jobs:
authorize:
runs-on: ubuntu-latest
steps:
- uses: octokit/[email protected]
with:
route: GET /orgs/:organisation/teams/:team/memberships/${{ github.actor }}
team: technical-steering-committee
organisation: webdriverio
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
npm-release:
needs: [authorize]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: 'main'
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: 14.x
- 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 "[email protected]"
git config --global user.name "WebdriverIO Release Bot"
- name: Install Dependencies
run: yarn install
- name: Release
run: npm run release:ci -- ${{github.event.inputs.releaseType}}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
16 changes: 15 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,18 @@ Any help is appreciated!

## Set Up Project

`npm install`
To set up the project, run:

```sh
$ npm install
```

You should then be able to run tests that pass via:

```sh
$ npm test
```

# Release

Only members of the Technical Steering Committee (TSC) team of the WebdriverIO org can release the package. If you are a member, just trigger the `Manual NPM Publish` workflow and pick a release type, e.g. `patch`, `minor` or `major`.
Loading

0 comments on commit 7bef031

Please sign in to comment.