1- # Registers or updates a version record for this project in the ddproxy registry.
2- # Triggered automatically on v* tags. Can also be run manually to patch an
3- # existing version (e.g. to add a Gitea tag URL after initial GitHub registration).
4- #
5- # On tag push: creates a new version record with changelog from git history
6- # On manual run: patches an existing version with only the provided fields
7- #
8- # Required secrets:
9- # REGISTRY_TOKEN - Token with write access to the registry repository
10- #
11- # Optional repository variables:
12- # GITEA_BASE_URL - Base URL of your Gitea instance (e.g. https://git.example.com)
13- # GITEA_ORG - Gitea org that owns this repo (e.g. com.example)
14-
151name : Upsert Version
162
173on :
5541 - name : Resolve version metadata
5642 id : meta
5743 run : |
58- # On tag push use the tag; on manual dispatch use the input
5944 if [ "${{ github.event_name }}" = "push" ]; then
6045 TAG="${GITHUB_REF_NAME}"
6146 else
7459 PROJECT_NAME="${GITHUB_REPOSITORY##*/}"
7560 fi
7661
77- # Override license from input if provided
7862 [ -n "${{ inputs.license }}" ] && LICENSE="${{ inputs.license }}"
7963
80- # Changelog: auto-build from git log on tag push, else use input
8164 CHANGELOG="${{ inputs.changelog }}"
8265 if [ -z "$CHANGELOG" ] && [ "${{ github.event_name }}" = "push" ]; then
8366 PREV_TAG=$(git tag --sort=-version:refname | grep -v "^${TAG}$" | head -1)
8871 fi
8972 fi
9073
91- # Asset and tag URLs
9274 ASSET_SOURCE="${{ inputs.asset_source }}"
9375 [ -z "$ASSET_SOURCE" ] && \
9476 ASSET_SOURCE="https://github.com/${GITHUB_REPOSITORY}/archive/refs/tags/${TAG}.tar.gz"
@@ -114,16 +96,24 @@ jobs:
11496 echo "EOF"
11597 } >> $GITHUB_OUTPUT
11698
117- - name : Upsert version in registry
118- uses : ddproxy/registry-actions/actions/upsert-version@v0.1.0
99+ - name : Build dispatch payload
100+ id : payload
101+ run : |
102+ echo "inputs_json=$(jq -cn \
103+ --arg project_name "${{ steps.meta.outputs.project_name }}" \
104+ --arg version "${{ steps.meta.outputs.version }}" \
105+ --arg changelog "${{ steps.meta.outputs.changelog }}" \
106+ --arg asset_source "${{ steps.meta.outputs.asset_source }}" \
107+ --arg asset_binary "${{ inputs.asset_binary }}" \
108+ --arg repo_tag_github "${{ steps.meta.outputs.repo_tag_github }}" \
109+ --arg repo_tag_gitea "${{ steps.meta.outputs.repo_tag_gitea }}" \
110+ --arg license "${{ steps.meta.outputs.license }}" \
111+ '{project_name:$project_name,version:$version,changelog:$changelog,asset_source:$asset_source,asset_binary:$asset_binary,repo_tag_github:$repo_tag_github,repo_tag_gitea:$repo_tag_gitea,license:$license}')" \
112+ >> $GITHUB_OUTPUT
113+
114+ - name : Dispatch upsert-version to registry
115+ uses : ddproxy/registry-actions/actions/trigger-dispatch@v0.1.0
119116 with :
120- project_name : ${{ steps.meta.outputs.project_name }}
121- version : ${{ steps.meta.outputs.version }}
122- changelog : ${{ steps.meta.outputs.changelog }}
123- asset_source : ${{ steps.meta.outputs.asset_source }}
124- repo_tag_github : ${{ steps.meta.outputs.repo_tag_github }}
125- repo_tag_gitea : ${{ steps.meta.outputs.repo_tag_gitea }}
126- license : ${{ steps.meta.outputs.license }}
127- registry_repo : project-registry
128- registry_owner : ddproxy
117+ workflow_name : upsert-version.yml
118+ inputs_json : ${{ steps.payload.outputs.inputs_json }}
129119 github_token : ${{ secrets.REGISTRY_TOKEN }}
0 commit comments