From 0025b13da7111e2e643d9f76392aa7047254089e Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 3 Dec 2024 09:48:11 -0800 Subject: [PATCH 1/3] chore: automate releases with knope --- .github/workflows/prepare-release.yml | 26 +++++++++++++ .github/workflows/release.yml | 27 ++++++++++++++ go.mod | 2 +- knope.toml | 54 +++++++++++++++++++++++++++ 4 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/prepare-release.yml create mode 100644 .github/workflows/release.yml create mode 100644 knope.toml diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 0000000..7b6ca01 --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -0,0 +1,26 @@ +on: + push: + branches: [master] + +permissions: + contents: write + pull-requests: write + +name: Create Release PR +jobs: + prepare-release: + if: "!contains(github.event.head_commit.message, 'chore: prepare release')" # Skip merges from releases + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + - name: Configure Git + run: | + git config --global user.name github-actions[bot] + git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com + - uses: knope-dev/action@407e9ef7c272d2dd53a4e71e39a7839e29933c48 + - run: knope prepare-release --verbose + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + continue-on-error: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bd5b98b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,27 @@ +on: + pull_request: + types: + - closed + branches: + - master + +permissions: + contents: write + +name: Create Release PR +jobs: + prepare-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + - name: Configure Git + run: | + git config --global user.name github-actions[bot] + git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com + - uses: knope-dev/action@407e9ef7c272d2dd53a4e71e39a7839e29933c48 + - run: knope release --verbose + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + continue-on-error: true diff --git a/go.mod b/go.mod index 82bfc26..5d1df8f 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module go.sia.tech/coreutils +module go.sia.tech/coreutils // v0.7.0 go 1.23.1 diff --git a/knope.toml b/knope.toml new file mode 100644 index 0000000..3aea5f1 --- /dev/null +++ b/knope.toml @@ -0,0 +1,54 @@ +[package] +changelog = "CHANGELOG.md" +versioned_files = ["go.mod"] +ignore_go_major_versioning = true + +[[workflows]] +name = "document-change" + +[[workflows.steps]] +type = "CreateChangeFile" + +[[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 release $version\"" +variables = { "$version" = "Version" } + +[[workflows.steps]] +type = "Command" +command = "git push --force --set-upstream origin release" + +[workflows.steps.variables] +"$version" = "Version" + +[[workflows.steps]] +type = "CreatePullRequest" +base = "master" + +[workflows.steps.title] +template = "chore: prepare release $version" +variables = { "$version" = "Version" } + +[workflows.steps.body] +template = "This PR was created automatically. Merging it will create a new release for $version\n\n$changelog" +variables = { "$changelog" = "ChangelogEntry", "$version" = "Version" } + +[[workflows]] +name = "release" + +[[workflows.steps]] +type = "Release" + +[github] +owner = "SiaFoundation" +repo = "hostd" From 4aa3ef13d304cb691fcbf5b2774b5682a88fe7f8 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 3 Dec 2024 09:56:50 -0800 Subject: [PATCH 2/3] add first changeset --- .changeset/automate_releases.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/automate_releases.md diff --git a/.changeset/automate_releases.md b/.changeset/automate_releases.md new file mode 100644 index 0000000..d5fea6e --- /dev/null +++ b/.changeset/automate_releases.md @@ -0,0 +1,5 @@ +--- +default: patch +--- + +# Automate releases From 35640a58afcf2e2948495a643f88bf1774d90bb8 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 4 Dec 2024 07:05:10 -0800 Subject: [PATCH 3/3] fix knope repo --- knope.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knope.toml b/knope.toml index 3aea5f1..7f5f214 100644 --- a/knope.toml +++ b/knope.toml @@ -51,4 +51,4 @@ type = "Release" [github] owner = "SiaFoundation" -repo = "hostd" +repo = "coreutils"