Skip to content

Commit 49ad5a3

Browse files
committed
ci(release): migrate releases to python-semantic-release monorepo pipeline
1 parent cc9205b commit 49ad5a3

File tree

8 files changed

+114
-163
lines changed

8 files changed

+114
-163
lines changed

.github/workflows/release.yml

Lines changed: 71 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,74 +2,95 @@ name: Release
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
dry_run:
7+
description: "Dry run (no tags/releases created)"
8+
required: false
9+
default: "false"
10+
type: choice
11+
options:
12+
- "false"
13+
- "true"
14+
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
issues: write
19+
20+
env:
21+
PYTHON_SEMANTIC_RELEASE_VERSION: "10.5.3"
522

623
jobs:
724
lint:
8-
if: github.ref == 'refs/heads/main' && github.actor == 'bot-anik'
25+
if: github.repository == 'axone-protocol/contracts'
926
uses: ./.github/workflows/lint.yml
1027

1128
build:
12-
if: github.ref == 'refs/heads/main' && github.actor == 'bot-anik'
29+
if: github.repository == 'axone-protocol/contracts'
1330
uses: ./.github/workflows/build.yml
1431

1532
test:
16-
if: github.ref == 'refs/heads/main' && github.actor == 'bot-anik'
33+
if: github.repository == 'axone-protocol/contracts'
1734
uses: ./.github/workflows/test.yml
1835

19-
perform-release:
20-
if: github.ref == 'refs/heads/main' && github.actor == 'bot-anik'
21-
needs:
22-
- lint
23-
- build
24-
- test
36+
check-configured-projects:
37+
if: github.repository == 'axone-protocol/contracts'
38+
needs: [lint, build, test]
2539
runs-on: ubuntu-22.04
40+
outputs:
41+
matrix: ${{ steps.set-matrix.outputs.matrix }}
2642
steps:
27-
- name: Check out repository
28-
uses: actions/checkout@v6
29-
with:
30-
token: ${{ secrets.OPS_TOKEN }}
43+
- uses: actions/checkout@v4
44+
- id: set-matrix
45+
run: |
46+
PROJECT_DIRS=$(find contracts packages -maxdepth 2 -name "pyproject.toml" -print0 \
47+
| xargs -0 -n1 dirname \
48+
| jq -R -s -c 'split("\n")[:-1]')
3149
32-
- name: Import GPG key
33-
uses: crazy-max/ghaction-import-gpg@v6
34-
with:
35-
gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
36-
passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }}
37-
git_config_global: true
38-
git_user_signingkey: true
39-
git_commit_gpgsign: true
50+
echo "Found projects: $PROJECT_DIRS"
51+
echo "matrix=$PROJECT_DIRS" >> $GITHUB_OUTPUT
4052
41-
- name: Setup node
42-
uses: actions/setup-node@v6
53+
release:
54+
needs: check-configured-projects
55+
if: ${{ needs.check-configured-projects.outputs.matrix != '[]' && needs.check-configured-projects.outputs.matrix != '' }}
56+
runs-on: ubuntu-22.04
57+
strategy:
58+
fail-fast: false
59+
max-parallel: 1
60+
matrix:
61+
project_dir: ${{ fromJSON(needs.check-configured-projects.outputs.matrix) }}
62+
steps:
63+
- uses: actions/checkout@v4
4364
with:
44-
node-version: 20
65+
fetch-depth: 0
66+
token: ${{ secrets.OPS_TOKEN }}
4567

46-
- name: Setup jq
47-
uses: dcarbone/install-jq-action@v3
48-
with:
49-
version: 1.7
50-
force: true
68+
- name: Configure git author
69+
run: |
70+
git config user.name "${{ github.actor }}"
71+
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
5172
52-
- name: Setup rust
53-
uses: actions-rust-lang/setup-rust-toolchain@v1
73+
- name: Sync to latest remote
74+
run: |
75+
git fetch --tags origin
76+
git fetch origin "+refs/heads/*:refs/remotes/origin/*"
77+
git checkout "${GITHUB_REF_NAME}"
78+
git reset --hard "origin/${GITHUB_REF_NAME}"
5479
55-
- name: Install cargo make
56-
uses: davidB/rust-cargo-make@v1
80+
- name: Python Semantic Release (Dry Run)
81+
if: github.event.inputs.dry_run == 'true'
82+
run: |
83+
pip install python-semantic-release==${{ env.PYTHON_SEMANTIC_RELEASE_VERSION }}
84+
cd ${{ matrix.project_dir }}
85+
semantic-release -vv --noop version
86+
env:
87+
GH_TOKEN: ${{ secrets.OPS_TOKEN }}
5788

58-
- name: Release project
59-
uses: cycjimmy/semantic-release-action@v5
89+
- name: Python Semantic Release (Real)
90+
if: github.event.inputs.dry_run != 'true'
91+
uses: python-semantic-release/python-semantic-release@v${{ env.PYTHON_SEMANTIC_RELEASE_VERSION }}
6092
with:
61-
semantic_version: 22.0.5
62-
branch: main
63-
extra_plugins: |
64-
@semantic-release/changelog
65-
@semantic-release/exec@6.0.3
66-
@semantic-release/git
67-
semantic-release-replace-plugin@1.2.7
68-
extends: |
69-
conventional-changelog-conventionalcommits@7.0.1
70-
env:
71-
GITHUB_TOKEN: ${{ secrets.OPS_TOKEN }}
72-
GIT_AUTHOR_NAME: ${{ vars.BOT_GIT_AUTHOR_NAME }}
73-
GIT_AUTHOR_EMAIL: ${{ vars.BOT_GIT_AUTHOR_EMAIL }}
74-
GIT_COMMITTER_NAME: ${{ vars.BOT_GIT_COMMITTER_NAME }}
75-
GIT_COMMITTER_EMAIL: ${{ vars.BOT_GIT_COMMITTER_EMAIL }}
93+
config_file: ${{ matrix.project_dir }}/pyproject.toml
94+
github_token: ${{ secrets.OPS_TOKEN }}
95+
verbosity: 1
96+
strict: true

.releaserc.cjs

Lines changed: 0 additions & 106 deletions
This file was deleted.

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ keywords = ["cosmwasm", "blockchain"]
1010
license = "BSD-3-Clause"
1111
repository = "https://github.com/axone-protocol/contracts"
1212
rust-version = "1.82"
13-
version = "8.0.0"
1413

1514
[profile.release]
1615
codegen-units = 1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
[![built with cargo-make](https://img.shields.io/badge/build_with-cargo_make-d39f59?style=for-the-badge)](https://sagiegurari.github.io/cargo-make)
1111
[![conventional commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=for-the-badge&logo=conventionalcommits)](https://conventionalcommits.org)
12-
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge)](https://github.com/semantic-release/semantic-release)
12+
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge)](https://github.com/python-semantic-release/python-semantic-release)
1313
[![license](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg?style=for-the-badge)](https://opensource.org/licenses/BSD-3-Clause)
1414

1515
## ✨ Smart Contracts

contracts/axone-gov/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = { workspace = true }
88
name = "axone-gov"
99
repository = { workspace = true }
1010
rust-version = { workspace = true }
11-
version = { workspace = true }
11+
version = "0.1.0"
1212

1313
exclude = [
1414
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
@@ -71,5 +71,5 @@ thiserror.workspace = true
7171
[dev-dependencies]
7272
abstract-app = { workspace = true, features = ["test-utils"] }
7373
abstract-client.workspace = true
74-
axone-gov = { path = ".", version = "8.0.0", features = ["mock-logic-query"] }
74+
axone-gov = { path = ".", version = "0.1.0", features = ["mock-logic-query"] }
7575
serde.workspace = true

contracts/axone-gov/pyproject.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[tool.semantic_release]
2+
build_command = "cargo make release-wasm"
3+
commit_parser = "conventional-monorepo"
4+
major_on_zero = false
5+
tag_format = "axone-gov-v{version}"
6+
version_toml = ["contracts/axone-gov/Cargo.toml:package.version"]
7+
allow_zero_version = true
8+
9+
[tool.semantic_release.commit_parser_options]
10+
path_filters = ["contracts/axone-gov/**", "Cargo.toml", "Cargo.lock"]
11+
scope_prefix = "^axone-gov$"
12+
13+
[tool.semantic_release.branches.main]
14+
match = "main"
15+
prerelease = false
16+
prerelease_token = "rc"
17+
18+
[tool.semantic_release.changelog]
19+
exclude_commit_patterns = []
20+
mode = "update"
21+
22+
[tool.semantic_release.changelog.default_templates]
23+
changelog_file = "contracts/axone-gov/CHANGELOG.md"
24+
25+
[tool.semantic_release.commit_author]
26+
default = "semantic-release <semantic-release>"
27+
env = "GIT_COMMIT_AUTHOR"
28+
29+
[tool.semantic_release.publish]
30+
dist_glob_patterns = ["artifacts/axone_gov.wasm"]
31+
upload_to_vcs_release = true
32+
33+
[tool.semantic_release.remote]
34+
type = "github"
35+
36+
[tool.semantic_release.remote.token]
37+
env = "GH_TOKEN"

packages/axone-networks/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license.workspace = true
77
name = "axone-networks"
88
repository.workspace = true
99
rust-version.workspace = true
10-
version.workspace = true
10+
version = "0.1.0"
1111

1212
[dependencies]
1313
anyhow.workspace = true

0 commit comments

Comments
 (0)