Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update GHA workflows to support assisted publishing #46

Merged
merged 4 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,47 @@ on:
jobs:
build-lint-test:
name: Build, Lint, and Test
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [12.x, 14.x, 16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Get Yarn cache directory
run: echo "::set-output name=YARN_CACHE_DIR::$(yarn cache dir)"
id: yarn-cache-dir
- name: Get Yarn version
run: echo "::set-output name=YARN_VERSION::$(yarn --version)"
id: yarn-version
- name: Cache yarn dependencies
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }}
key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn build
- run: yarn lint
- run: yarn test
- name: Validate RC changelog
if: ${{ startsWith(github.head_ref, 'release/') }}
run: yarn auto-changelog validate --rc
- name: Validate changelog
if: ${{ !startsWith(github.head_ref, 'release/') }}
run: yarn auto-changelog validate
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty after building"
exit 1
fi
all-jobs-pass:
name: All jobs pass
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs:
- build-lint-test
steps:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Create Release Pull Request

on:
workflow_dispatch:
inputs:
base-branch:
description: 'The base branch for git operations and the pull request.'
default: 'main'
required: true
release-type:
description: 'A SemVer version diff, i.e. major, minor, patch, prerelease etc. Mutually exclusive with "release-version".'
required: false
release-version:
description: 'A specific version to bump to. Mutually exclusive with "release-type".'
required: false

jobs:
create-release-pr:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v2
with:
# This is to guarantee that the most recent tag is fetched.
# This can be configured to a more reasonable value by consumers.
fetch-depth: 0
# We check out the specified branch, which will be used as the base
# branch for all git operations and the release PR.
ref: ${{ github.event.inputs.base-branch }}
- name: Get Node.js version
id: nvm
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
- uses: actions/setup-node@v2
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
- uses: MetaMask/action-create-release-pr@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release-type: ${{ github.event.inputs.release-type }}
release-version: ${{ github.event.inputs.release-version }}
artifacts-path: gh-action__release-authors
# Upload the release author artifact for use in subsequent workflows
- uses: actions/upload-artifact@v2
with:
name: release-authors
path: gh-action__release-authors
if-no-files-found: error
29 changes: 29 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish Release

on:
pull_request:
types: [closed]

jobs:
publish-release:
permissions:
contents: write
if: |
github.event.pull_request.merged == true &&
startsWith(github.event.pull_request.head.ref, 'release/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# We check out the release pull request's base branch, which will be
# used as the base branch for all git operations.
ref: ${{ github.event.pull_request.base.ref }}
- name: Get Node.js version
id: nvm
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
- uses: actions/setup-node@v2
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
- uses: MetaMask/action-publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 4 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
Expand All @@ -8,29 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

## [2.0.1] - 2021-01-13

### Changed

- Update `2.0.0` changelog entry to reflect missing breaking

## [2.0.0] - 2021-01-10

### Added

- Support method signatures with array arguments ([#22](https://github.com/MetaMask/eth-method-registry/pull/22))

### Changed

- **(SEMVER-MAJOR)** Require `provider` argument ([#15](https://github.com/MetaMask/eth-method-registry/pull/15))
- **(SEMVER-MAJOR)** Move from default to named `MethodRegistry` export ([#21](https://github.com/MetaMask/eth-method-registry/pull/21))
- Migrate to TypeScript ([#21](https://github.com/MetaMask/eth-method-registry/pull/21))

## [1.2.0] - 2019-04-15

### Added

- Support method signatures with tuple arguments ([#6](https://github.com/MetaMask/eth-method-registry/pull/6))

[Unreleased]:https://github.com/MetaMask/eth-method-registry/compare/v2.0.0...HEAD
[2.0.0]:https://github.com/MetaMask/eth-method-registry/compare/v1.2.0...v2.0.0
[1.2.0]:https://github.com/MetaMask/eth-method-registry/compare/v1.1.0...v1.2.0
[Unreleased]: https://github.com/MetaMask/eth-method-registry/compare/v2.0.1...HEAD
[2.0.1]: https://github.com/MetaMask/eth-method-registry/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/MetaMask/eth-method-registry/compare/v1.2.0...v2.0.0
[1.2.0]: https://github.com/MetaMask/eth-method-registry/releases/tag/v1.2.0
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Eth Method Registry [![CircleCI](https://circleci.com/gh/danfinlay/eth-method-registry.svg?style=svg)](https://circleci.com/gh/danfinlay/eth-method-registry)
# Eth Method Registry

A javascript library for getting Solidity method data from a four-byte method signature.

Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
},
"devDependencies": {
"@metamask/eslint-config": "^4.0.0",
"@metamask/auto-changelog": "^2.6.1",
"@typescript-eslint/eslint-plugin": "^4.12.0",
"@typescript-eslint/parser": "^4.12.0",
"babel-runtime": "^6.26.0",
Expand All @@ -38,7 +39,7 @@
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/danfinlay/eth-method-registry.git"
"url": "https://github.com/MetaMask/eth-method-registry.git"
},
"keywords": [
"Ethereum",
Expand All @@ -47,9 +48,9 @@
"signature"
],
"bugs": {
"url": "https://github.com/danfinlay/eth-method-registry/issues"
"url": "https://github.com/MetaMask/eth-method-registry/issues"
},
"homepage": "https://github.com/danfinlay/eth-method-registry#readme",
"homepage": "https://github.com/MetaMask/eth-method-registry#readme",
"files": [
"dist"
]
Expand Down
Loading
Loading