forked from gakonst/ethers-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release process and CI (gakonst#1240)
* Fix the crate versions * release.toml: add cargo-release config * CONTRIBUTING.md: Update Releasing section * feat: add release github workflow * feat: generate CHANGELOGs and create github releases in CI
- Loading branch information
1 parent
135bca4
commit 6d5bebd
Showing
18 changed files
with
182 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const semver = require("semver"); | ||
|
||
const previousVersion = (currentVersion, releaseType) => { | ||
const parsedVersion = semver.parse(currentVersion); | ||
|
||
switch (releaseType) { | ||
case "major": { | ||
return `v${parsedVersion.major - 1}.0.0`; | ||
} | ||
case "minor": { | ||
return `v${parsedVersion.major}.${parsedVersion.minor - 1}.0`; | ||
} | ||
case "patch": { | ||
return `v${parsedVersion.major}.${parsedVersion.minor}.${ | ||
parsedVersion.patch - 1 | ||
}`; | ||
} | ||
case "alpha": { | ||
return `v${parsedVersion.major}.${parsedVersion.minor}.${ | ||
parsedVersion.patch | ||
}-alpha.${parsedVersion.prerelease[1] - 1}`; | ||
} | ||
case "beta": { | ||
return `v${parsedVersion.major}.${parsedVersion.minor}.${ | ||
parsedVersion.patch | ||
}-beta.${parsedVersion.prerelease[1] - 1}`; | ||
} | ||
case "rc": { | ||
return `v${parsedVersion.major}.${parsedVersion.minor}.${ | ||
parsedVersion.patch | ||
}-rc.${parsedVersion.prerelease[1] - 1}`; | ||
} | ||
} | ||
}; | ||
|
||
const [currentVersion, releaseType] = process.argv.slice(-2); | ||
console.log(previousVersion(currentVersion, releaseType)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: Release | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * 0" | ||
|
||
workflow_dispatch: | ||
inputs: | ||
release_type: | ||
type: choice | ||
description: Release type | ||
options: | ||
- major | ||
- minor | ||
- patch | ||
- rc | ||
- beta | ||
- alpha | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
env: | ||
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }} | ||
RELEASE_TYPE: ${{ github.event.inputs.release_type }} | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Configure git | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
- name: Rust stable | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
- uses: Swatinem/rust-cache@v1 | ||
with: | ||
cache-on-failure: true | ||
- name: Install cargo-release | ||
uses: actions-rs/[email protected] | ||
with: | ||
crate: cargo-release | ||
version: latest | ||
- name: Cargo login | ||
run: | | ||
cargo login $CARGO_TOKEN | ||
- name: Dry-run cargo release | ||
run: | | ||
cargo release --workspace ${RELEASE_TYPE:-alpha} --exclude ethers-wasm | ||
- name: Publish release | ||
run: | | ||
cargo release --workspace ${RELEASE_TYPE:-alpha} --exclude ethers-wasm --execute --no-confirm | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 14 | ||
- run: | | ||
npm i semver | ||
- name: Install git-cliff | ||
uses: actions-rs/[email protected] | ||
with: | ||
crate: git-cliff | ||
version: latest | ||
- name: Publish changelog | ||
id: changelog | ||
run: | | ||
current_version=$(git tag --contains HEAD -l "v*" | head -1) | ||
from_version=$(node .github/workflows/release-tag-from.js $current_version $RELEASE_TYPE) | ||
echo from $from_version to $current_version | ||
echo "::set-output name=release_version::$(echo $current_version)" | ||
if git rev-parse "$from_version" >/dev/null 2>&1; then | ||
echo "tag exists, can generate changelog"; | ||
else | ||
echo "tag does not exist, cannot generate changelog, publish github release manually" | ||
exit 0 | ||
fi | ||
git cliff $from_version..$current_version > GENERATED_CHANGELOG.md | ||
cat GENERATED_CHANGELOG.md | ||
- name: Create GitHub release | ||
id: release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
RELEASE_VERSION: ${{ steps.changelog.outputs.release_version }} | ||
with: | ||
tag_name: ${{ env.RELEASE_VERSION }} | ||
release_name: ${{ env.RELEASE_VERSION }} | ||
body_path: GENERATED_CHANGELOG.md | ||
prerelease: ${{ env.RELEASE_TYPE == 'alpha' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "ethers" | ||
version = "0.6.0" | ||
version = "0.6.2" | ||
authors = ["Georgios Konstantopoulos <[email protected]>"] | ||
license = "MIT OR Apache-2.0" | ||
edition = "2021" | ||
|
@@ -150,4 +150,4 @@ required-features = ["trezor"] | |
[[example]] | ||
name = "yubi" | ||
path = "examples/yubi.rs" | ||
required-features = ["yubi"] | ||
required-features = ["yubi"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
name = "ethers-contract" | ||
license = "MIT OR Apache-2.0" | ||
version = "0.6.0" | ||
version = "0.6.2" | ||
authors = ["Georgios Konstantopoulos <[email protected]>"] | ||
edition = "2018" | ||
description = "Smart contract bindings for the ethers-rs crate" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "ethers-contract-abigen" | ||
version = "0.6.0" | ||
version = "0.6.3" | ||
authors = ["Nicholas Rodrigues Lordello <[email protected]>", "Georgios Konstantopoulos <[email protected]>"] | ||
edition = "2018" | ||
license = "MIT OR Apache-2.0" | ||
|
@@ -41,4 +41,4 @@ rustls = ["reqwest/rustls-tls"] | |
|
||
[dev-dependencies] | ||
tempfile = "3.2.0" | ||
ethers-solc = { path = "../../ethers-solc", default-features = false, features = ["project-util"] } | ||
ethers-solc = { version = "^0.3.0", path = "../../ethers-solc", default-features = false, features = ["project-util"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "ethers-contract-derive" | ||
version = "0.6.0" | ||
version = "0.6.3" | ||
authors = ["Nicholas Rodrigues Lordello <[email protected]>", "Georgios Konstantopoulos <[email protected]>"] | ||
edition = "2018" | ||
license = "MIT OR Apache-2.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
name = "ethers-core" | ||
license = "MIT OR Apache-2.0" | ||
version = "0.6.0" | ||
version = "0.6.3" | ||
authors = ["Georgios Konstantopoulos <[email protected]>"] | ||
edition = "2018" | ||
description = "Core structures for the ethers-rs crate" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "ethers-etherscan" | ||
version = "0.2.0" | ||
version = "0.2.2" | ||
authors = ["Matthias Seitz <[email protected]>", "Georgios Konstantopoulos <[email protected]>"] | ||
license = "MIT OR Apache-2.0" | ||
edition = "2018" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
name = "ethers-middleware" | ||
license = "MIT OR Apache-2.0" | ||
version = "0.6.0" | ||
version = "0.6.2" | ||
authors = ["Georgios Konstantopoulos <[email protected]>"] | ||
edition = "2018" | ||
description = "Middleware implementations for the ethers-rs crate" | ||
|
Oops, something went wrong.