Skip to content

Commit

Permalink
Merge pull request #64 from SiaFoundation/nate/knope
Browse files Browse the repository at this point in the history
Automate releases
  • Loading branch information
n8maninger authored Nov 17, 2024
2 parents 6c06d02 + 2ecefcc commit 5ab09ec
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/v2_signing_implemented.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sia_sdk: patch
---

# v2 signing implemented
25 changes: 25 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Prepare Release

on:
workflow_dispatch:
push:
branches:
- master

permissions:
contents: read
pull-requests: write

jobs:
prepare-release:
if: "!contains(github.event.head_commit.message, 'chore: prepare releases')" # Skip merges from releases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Environment
run: |
rustup update stable
cargo install knope
- run: knope prepare-release --verbose
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release

on:
pull_request:
types: [closed]
branches: [main]

jobs:
release:
if: github.head_ref == 'release' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Environment
run: |
rustup update stable
cargo install knope
- name: Release
run: |
knope release
cargo publish -p sia_sdk_derive
cargo publish -p sia_sdk
45 changes: 45 additions & 0 deletions knope.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[packages.sia_sdk]
versioned_files = ["sia/Cargo.toml"]
changelog = "sia/CHANGELOG.md"

[packages.sia_sdk_derive]
versioned_files = ["sia_derive/Cargo.toml"]
changelog = "sia_derive/CHANGELOG.md"

[[workflows]]
name = "prepare-release"

[[workflows.steps]]
type = "Command"
command = "git switch -c release"

[[workflows.steps]]
type = "PrepareRelease"

[[workflows.steps]]
type = "Command"
command = "git commit -m \"chore: prepare releases\""

[[workflows.steps]]
type = "Command"
command = "git push --force --set-upstream origin release"

[[workflows.steps]]
type = "CreatePullRequest"
base = "master"

[workflows.steps.title]
template = "chore: prepare releases"

[workflows.steps.body]
template = "This PR was created automatically. Merging it will create a new release. See changelogs for details."

[[workflows]]
name = "release"

[[workflows.steps]]
type = "Release"

[github]
owner = "SiaFoundation"
repo = "sia-sdk-rs"

0 comments on commit 5ab09ec

Please sign in to comment.