Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 96eda294fd |
@@ -1,106 +0,0 @@
|
|||||||
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
#
|
|
||||||
# BRIEF: Update MokoOnyx submodule in MokoWaas on main and dev branches
|
|
||||||
|
|
||||||
name: "Update MokoWaas Submodule"
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
|
|
||||||
env:
|
|
||||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
||||||
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
|
||||||
WAAS_ORG: ${{ vars.GITEA_ORG || github.repository_owner }}
|
|
||||||
WAAS_REPO: MokoWaaS
|
|
||||||
# Path where MokoOnyx lives as a submodule inside MokoWaaS
|
|
||||||
SUBMODULE_PATH: src/packages/tpl_mokoonyx
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update-submodule:
|
|
||||||
name: "Update submodule on ${{ matrix.branch }}"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
branch: [main, dev]
|
|
||||||
fail-fast: false
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Get release info
|
|
||||||
id: release
|
|
||||||
run: |
|
|
||||||
TAG="${{ github.event.release.tag_name }}"
|
|
||||||
IS_PRE="${{ github.event.release.prerelease }}"
|
|
||||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
|
||||||
echo "prerelease=${IS_PRE}" >> $GITHUB_OUTPUT
|
|
||||||
echo "Release tag: ${TAG} (prerelease: ${IS_PRE})"
|
|
||||||
|
|
||||||
# Skip pre-releases (RC) — only update on stable releases
|
|
||||||
- name: Skip pre-releases
|
|
||||||
if: steps.release.outputs.prerelease == 'true'
|
|
||||||
run: |
|
|
||||||
echo "Skipping pre-release ${TAG} — only stable releases update MokoWaas"
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
- name: Clone MokoWaas
|
|
||||||
if: steps.release.outputs.prerelease != 'true'
|
|
||||||
run: |
|
|
||||||
git clone --branch "${{ matrix.branch }}" --depth 1 --recurse-submodules \
|
|
||||||
"https://x-access-token:${{ secrets.MOKOGITEA_TOKEN }}@git.mokoconsulting.tech/${WAAS_ORG}/${WAAS_REPO}.git" \
|
|
||||||
waas
|
|
||||||
env:
|
|
||||||
GIT_TERMINAL_PROMPT: 0
|
|
||||||
|
|
||||||
- name: Configure git
|
|
||||||
if: steps.release.outputs.prerelease != 'true'
|
|
||||||
working-directory: waas
|
|
||||||
run: |
|
|
||||||
git config user.email "gitea-actions[bot]@mokoconsulting.tech"
|
|
||||||
git config user.name "gitea-actions[bot]"
|
|
||||||
git remote set-url origin \
|
|
||||||
"https://x-access-token:${{ secrets.MOKOGITEA_TOKEN }}@git.mokoconsulting.tech/${WAAS_ORG}/${WAAS_REPO}.git"
|
|
||||||
|
|
||||||
- name: Update submodule to release tag
|
|
||||||
if: steps.release.outputs.prerelease != 'true'
|
|
||||||
working-directory: waas
|
|
||||||
run: |
|
|
||||||
TAG="${{ steps.release.outputs.tag }}"
|
|
||||||
SUBPATH="${SUBMODULE_PATH}"
|
|
||||||
|
|
||||||
# Verify submodule exists
|
|
||||||
if [ ! -f ".gitmodules" ] || ! grep -q "${SUBPATH}" .gitmodules; then
|
|
||||||
echo "::error::Submodule '${SUBPATH}' not found in .gitmodules on ${{ matrix.branch }}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Fetch the tag in the submodule and update to it
|
|
||||||
cd "${SUBPATH}"
|
|
||||||
git fetch origin "refs/tags/${TAG}:refs/tags/${TAG}" --depth 1
|
|
||||||
git checkout "${TAG}"
|
|
||||||
cd -
|
|
||||||
|
|
||||||
# Stage the submodule pointer change
|
|
||||||
git add "${SUBPATH}"
|
|
||||||
|
|
||||||
# Only commit if there's actually a change
|
|
||||||
if git diff --cached --quiet; then
|
|
||||||
echo "Submodule already at ${TAG} on ${{ matrix.branch }} — nothing to do"
|
|
||||||
else
|
|
||||||
git commit -m "chore: update MokoOnyx submodule to ${TAG}
|
|
||||||
|
|
||||||
Authored-by: Moko Consulting"
|
|
||||||
git push origin "${{ matrix.branch }}"
|
|
||||||
echo "Updated MokoOnyx to ${TAG} on ${{ matrix.branch }}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Summary
|
|
||||||
if: always() && steps.release.outputs.prerelease != 'true'
|
|
||||||
run: |
|
|
||||||
TAG="${{ steps.release.outputs.tag }}"
|
|
||||||
echo "## MokoWaas Submodule Update (${{ matrix.branch }})" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "Updated \`${SUBMODULE_PATH}\` to \`${TAG}\`" >> $GITHUB_STEP_SUMMARY
|
|
||||||
Reference in New Issue
Block a user