Skip to content

Commit

Permalink
Merge pull request #712 from camptocamp/backport/711-to-1.3
Browse files Browse the repository at this point in the history
[Backport 1.3] Fix publish in dev mode
  • Loading branch information
sbrunner authored Sep 21, 2022
2 parents ea21099 + 2820a25 commit a178da0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/clean.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
---
name: Clean docker hub tags

on: delete
on:
delete:
pull_request:
types:
- closed

jobs:
clean:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ jobs:
- name: Build example
run: (cd example-project/; make)

- name: Prepare publish
run: |
sed --in-place 's/^# format/format/g' pyproject.toml
cat pyproject.toml
if: |
env.HAS_SECRETS == 'HAS_SECRETS'
- name: Publish
run: c2cciutils-publish
if: |
Expand Down
1 change: 1 addition & 0 deletions c2cciutils/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ def pip(
subprocess.run([f"{venv}/bin/pip", "install", "poetry"], check=True)
for requirement in pyproject.get("build-system", {}).get("requires", []):
print(f"Install requirement {requirement}")
sys.stdout.flush()
subprocess.run([f"{venv}/bin/pip", "install", requirement], check=True)
subprocess.run(["poetry", "--version"], check=True)
subprocess.run([f"{venv}/bin/poetry", "build"], cwd=cwd, env=env, check=True)
Expand Down
4 changes: 3 additions & 1 deletion c2cciutils/scripts/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ def main() -> None:
).json()["token"]

with open(os.environ["GITHUB_EVENT_PATH"], encoding="utf-8") as event_file:
ref = json.loads(event_file.read())["ref"]
event = json.loads(event_file.read())
print(event)
ref = event["ref"]

ref = ref.replace("/", "_")

Expand Down
5 changes: 4 additions & 1 deletion c2cciutils/scripts/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def main() -> None:
print("ERROR: you specified more than one of the arguments --version, --branch or --tag")
sys.exit(1)

version_type = args.type

tag_match = c2cciutils.match(
ref,
c2cciutils.compile_re(config["version"].get("tag_to_version_re", []), "refs/tags/"),
Expand All @@ -104,8 +106,9 @@ def main() -> None:
ref_match = re.match(r"refs/pull/(.*)/merge", ref)
if ref_match is not None:
branch_match = (ref_match, {}, ref)
if version_type is None:
version_type = "feature_branch"

version_type = args.type
if args.version is not None:
version = args.version
elif args.branch is not None:
Expand Down

0 comments on commit a178da0

Please sign in to comment.