Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update JSON file during semantic release #1026

Closed
Labels
@adrien-riaux-ext

Description

@adrien-riaux-ext

Question

Hello, I want to know if it is possible to update a JSON file using the resulting tag of the semantic release before upload the release to GitHub.
I tried something, but myplugin.json file is not updated by the CI/CD, should I use theassets key in the TOML file to specify the path to my JSON file, or manually add commit and push in the CI/CD script ?

Configuration

I use GitHub Action to run semantic release, here is the CI/CD:

name:"Run Semantic Release"on:push:branches:[main]jobs:release:runs-on:ubuntu-lateststrategy:matrix:python-version:["3.9"]poetry-version:["1.8.3"]permissions:contents:writeid-token:writeconcurrency:releasesteps:#----------------------------------------------# Check-out repository#----------------------------------------------      -name:Check out codeuses:actions/checkout@v4#----------------------------------------------# Setup Workflow#----------------------------------------------      -name:Setup Workflowuses:./.github/actions/setupwith:python-version:${{ matrix.python-version }}poetry-version:${{ matrix.poetry-version }}load-cache:true#----------------------------------------------# Run Semantic Release#----------------------------------------------      -name:Python Semantic Releaseid:releaseuses:python-semantic-release/python-semantic-release@v8.0.0with:github_token:${{ secrets.GITHUB_TOKEN }}#----------------------------------------------# Install JQ to parse JSON#----------------------------------------------      -name:Install JQrun:sudo apt-get update && sudo apt-get install jqshell:bash#----------------------------------------------# Update Plugin Version#----------------------------------------------      -name:Update Plugin Versionenv:tag:${{ steps.release.outputs.tag }}run:|          #!/bin/bash          # Update the version in plugin.json directly          jq --arg version "$tag" '.version = $version' plugin.json > tmp.json && mv tmp.json plugin.jsonshell:bash#----------------------------------------------# Publish#----------------------------------------------      -name:Publish package ditributions to GitHub Releasesuses:python-semantic-release/upload-to-gh-release@mainwith:github_token:${{ secrets.GITHUB_TOKEN }}

Semantic Release Configuration:

[tool.semantic_release]version_variables = ["python-lib/salesforecast_v2/__init__.py:__version__"]version_toml = ["pyproject.toml:tool.poetry.version"]assets = []tag_format ="{version}"commit_message ="conf: update plugin to {version} version"[tool.semantic_release.branches.main]match ="main"[tool.semantic_release.commit_parser_options]allowed_tags = ["add","rm","build","conf","config","cfg","ci","docs","feat","fix","perf","style","refacto","test",]minor_tags = ["feat"]patch_tags = ["fix","perf"][tool.semantic_release.publish]dist_glob_patterns = ["dist/*"]

Thanks in advance for your help !

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp