Skip to content

Commit

Permalink
Merge pull request #53 from Intreecom/feature/github-flow
Browse files Browse the repository at this point in the history
  • Loading branch information
s3rius authored Oct 31, 2024
2 parents 888860d + e3b3dbe commit 05fdab3
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Release

on:
push:
tags:
- '*'
release:
types:
- released

permissions:
contents: write
Expand All @@ -25,6 +25,9 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Bumping version
run: |
python ./scripts/version_bumper.py --target Cargo.toml "${{ github.ref_name }}"
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand Down Expand Up @@ -69,6 +72,9 @@ jobs:
with:
python-version: '3.10'
architecture: ${{ matrix.target }}
- name: Bumping version
run: |
python ./scripts/version_bumper.py --target Cargo.toml "${{ github.ref_name }}"
- name: Install OpenSSL
run: vcpkg install openssl:x64-windows-static-md
- name: Build wheels
Expand Down Expand Up @@ -100,6 +106,9 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Bumping version
run: |
python ./scripts/version_bumper.py --target Cargo.toml "${{ github.ref_name }}"
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand All @@ -123,6 +132,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Bumping version
run: |
python ./scripts/version_bumper.py --target Cargo.toml "${{ github.ref_name }}"
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
Expand Down Expand Up @@ -154,6 +169,9 @@ jobs:
with:
python-version: '3.11'
architecture: x64
- name: Bumping version
run: |
python ./scripts/version_bumper.py --target Cargo.toml "${{ github.ref_name }}"
- name: Instal OpenSSL
run: sudo apt-get update && sudo apt-get install libssl-dev openssl
- name: Build wheels
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "scyllapy"
version = "1.3.1"
version = "0.0.0"
edition = "2021"

[lib]
Expand Down
38 changes: 38 additions & 0 deletions scripts/version_bumper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import re
import argparse
from pathlib import Path


def parse_args() -> argparse.Namespace:
"""Parse command line arguments."""
parser = argparse.ArgumentParser()
parser.add_argument(
"--target",
"-t",
dest="target",
type=Path,
default="Cargo.toml",
)
parser.add_argument("version", type=str)
return parser.parse_args()


def main() -> None:
"""Main function."""
args = parse_args()
with args.target.open("r") as f:
contents = f.read()

contents = re.sub(
r"version\s*=\s*\"(.*)\"",
f'version = "{args.version}"',
contents,
count=1,
)

with args.target.open("w") as f:
f.write(contents)


if __name__ == "__main__":
main()

0 comments on commit 05fdab3

Please sign in to comment.