Skip to content

Commit ebcf87a

Browse files
committed
Update workflows and actions to shift responsibilities across registry-client, actions, project-template, and project-registry.
1 parent 3c5330b commit ebcf87a

4 files changed

Lines changed: 91 additions & 78 deletions

File tree

.gitea/workflows/upsert-project.yml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,29 @@ jobs:
6363
echo "repo_github=${REPO_GITHUB}" >> $GITHUB_OUTPUT
6464
echo "repo_gitea=${REPO_GITEA}" >> $GITHUB_OUTPUT
6565
66-
- name: Upsert project in registry
67-
uses: ddproxy/registry-actions/actions/upsert-project@v0.1.0
68-
with:
69-
project_name: ${{ steps.meta.outputs.project_name }}
70-
display_name: ${{ inputs.display_name }}
71-
description: ${{ steps.meta.outputs.description }}
72-
repo_github: ${{ steps.meta.outputs.repo_github }}
73-
repo_gitea: ${{ steps.meta.outputs.repo_gitea }}
74-
tags: ${{ inputs.tags }}
75-
license: ${{ steps.meta.outputs.license }}
76-
registry_repo: registry
77-
registry_owner: ${{ vars.GITEA_ORG || github.repository_owner }}
78-
github_token: ${{ secrets.GITEA_REGISTRY_TOKEN }}
66+
- name: Dispatch upsert-project to registry
67+
run: |
68+
REGISTRY_OWNER="${{ vars.GITEA_ORG || github.repository_owner }}"
69+
REGISTRY_REPO="registry"
70+
71+
curl -fsSL -X POST \
72+
"${GITHUB_SERVER_URL}/api/v1/repos/${REGISTRY_OWNER}/${REGISTRY_REPO}/actions/workflows/upsert-project.yml/dispatches" \
73+
-H "Authorization: token ${{ secrets.GITEA_REGISTRY_TOKEN }}" \
74+
-H "Content-Type: application/json" \
75+
-d "$(jq -n \
76+
--arg project_name "${{ steps.meta.outputs.project_name }}" \
77+
--arg display_name "${{ inputs.display_name }}" \
78+
--arg description "${{ steps.meta.outputs.description }}" \
79+
--arg repo_github "${{ steps.meta.outputs.repo_github }}" \
80+
--arg repo_gitea "${{ steps.meta.outputs.repo_gitea }}" \
81+
--arg tags "${{ inputs.tags }}" \
82+
--arg license "${{ steps.meta.outputs.license }}" \
83+
'{ref: "main", inputs: {
84+
project_name: $project_name,
85+
display_name: $display_name,
86+
description: $description,
87+
repo_github: $repo_github,
88+
repo_gitea: $repo_gitea,
89+
tags: $tags,
90+
license: $license
91+
}}')"

.gitea/workflows/upsert-version.yml

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ jobs:
7171
fi
7272
fi
7373
74-
# On Gitea Actions, GITHUB_SERVER_URL resolves to the Gitea instance
7574
ASSET_SOURCE="${{ inputs.asset_source }}"
7675
[ -z "$ASSET_SOURCE" ] && \
7776
ASSET_SOURCE="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/archive/refs/tags/${TAG}.tar.gz"
@@ -97,16 +96,31 @@ jobs:
9796
echo "EOF"
9897
} >> $GITHUB_OUTPUT
9998
100-
- name: Upsert version in registry
101-
uses: ddproxy/registry-actions/actions/upsert-version@v0.1.0
102-
with:
103-
project_name: ${{ steps.meta.outputs.project_name }}
104-
version: ${{ steps.meta.outputs.version }}
105-
changelog: ${{ steps.meta.outputs.changelog }}
106-
asset_source: ${{ steps.meta.outputs.asset_source }}
107-
repo_tag_github: ${{ steps.meta.outputs.repo_tag_github }}
108-
repo_tag_gitea: ${{ steps.meta.outputs.repo_tag_gitea }}
109-
license: ${{ steps.meta.outputs.license }}
110-
registry_repo: registry
111-
registry_owner: ${{ vars.GITEA_ORG || github.repository_owner }}
112-
github_token: ${{ secrets.GITEA_REGISTRY_TOKEN }}
99+
- name: Dispatch upsert-version to registry
100+
run: |
101+
REGISTRY_OWNER="${{ vars.GITEA_ORG || github.repository_owner }}"
102+
REGISTRY_REPO="registry"
103+
104+
curl -fsSL -X POST \
105+
"${GITHUB_SERVER_URL}/api/v1/repos/${REGISTRY_OWNER}/${REGISTRY_REPO}/actions/workflows/upsert-version.yml/dispatches" \
106+
-H "Authorization: token ${{ secrets.GITEA_REGISTRY_TOKEN }}" \
107+
-H "Content-Type: application/json" \
108+
-d "$(jq -n \
109+
--arg project_name "${{ steps.meta.outputs.project_name }}" \
110+
--arg version "${{ steps.meta.outputs.version }}" \
111+
--arg changelog "${{ steps.meta.outputs.changelog }}" \
112+
--arg asset_source "${{ steps.meta.outputs.asset_source }}" \
113+
--arg asset_binary "${{ inputs.asset_binary }}" \
114+
--arg repo_tag_github "${{ steps.meta.outputs.repo_tag_github }}" \
115+
--arg repo_tag_gitea "${{ steps.meta.outputs.repo_tag_gitea }}" \
116+
--arg license "${{ steps.meta.outputs.license }}" \
117+
'{ref: "main", inputs: {
118+
project_name: $project_name,
119+
version: $version,
120+
changelog: $changelog,
121+
asset_source: $asset_source,
122+
asset_binary: $asset_binary,
123+
repo_tag_github: $repo_tag_github,
124+
repo_tag_gitea: $repo_tag_gitea,
125+
license: $license
126+
}}')"

.github/workflows/upsert-project.yml

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
# Registers or updates this repository's project record in the ddproxy registry.
2-
# Run manually at any time — creates the record on first run, patches it on
3-
# subsequent runs. Only fields provided at dispatch time are changed.
4-
#
5-
# Required secrets:
6-
# REGISTRY_TOKEN - Token with write access to the registry repository
7-
#
8-
# Optional repository variables:
9-
# GITEA_BASE_URL - Base URL of your Gitea instance (e.g. https://git.example.com)
10-
# GITEA_ORG - Gitea org that owns this repo (e.g. com.example)
11-
121
name: Upsert Project
132

143
on:
@@ -76,16 +65,23 @@ jobs:
7665
echo "repo_github=${REPO_GITHUB}" >> $GITHUB_OUTPUT
7766
echo "repo_gitea=${REPO_GITEA}" >> $GITHUB_OUTPUT
7867
79-
- name: Upsert project in registry
80-
uses: ddproxy/registry-actions/actions/upsert-project@v0.1.0
68+
- name: Build dispatch payload
69+
id: payload
70+
run: |
71+
echo "inputs_json=$(jq -cn \
72+
--arg project_name "${{ steps.meta.outputs.project_name }}" \
73+
--arg display_name "${{ inputs.display_name }}" \
74+
--arg description "${{ steps.meta.outputs.description }}" \
75+
--arg repo_github "${{ steps.meta.outputs.repo_github }}" \
76+
--arg repo_gitea "${{ steps.meta.outputs.repo_gitea }}" \
77+
--arg tags "${{ inputs.tags }}" \
78+
--arg license "${{ steps.meta.outputs.license }}" \
79+
'{project_name:$project_name,display_name:$display_name,description:$description,repo_github:$repo_github,repo_gitea:$repo_gitea,tags:$tags,license:$license}')" \
80+
>> $GITHUB_OUTPUT
81+
82+
- name: Dispatch upsert-project to registry
83+
uses: ddproxy/registry-actions/actions/trigger-dispatch@v0.1.0
8184
with:
82-
project_name: ${{ steps.meta.outputs.project_name }}
83-
display_name: ${{ inputs.display_name }}
84-
description: ${{ steps.meta.outputs.description }}
85-
repo_github: ${{ steps.meta.outputs.repo_github }}
86-
repo_gitea: ${{ steps.meta.outputs.repo_gitea }}
87-
tags: ${{ inputs.tags }}
88-
license: ${{ steps.meta.outputs.license }}
89-
registry_repo: project-registry
90-
registry_owner: ddproxy
85+
workflow_name: upsert-project.yml
86+
inputs_json: ${{ steps.payload.outputs.inputs_json }}
9187
github_token: ${{ secrets.REGISTRY_TOKEN }}

.github/workflows/upsert-version.yml

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
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-
151
name: Upsert Version
162

173
on:
@@ -55,7 +41,6 @@ jobs:
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
@@ -74,10 +59,8 @@ jobs:
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)
@@ -88,7 +71,6 @@ jobs:
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

Comments
 (0)