name: Sync Mirror to GitCode on: push: branches: [main] release: types: [published, released, edited, prereleased] workflow_dispatch: inputs: tag: description: "Specific release tag to sync (empty = latest app release + all runtime-* releases)" required: false default: "" sync_releases: description: "Also sync Release metadata and assets to GitCode" type: boolean default: true concurrency: group: sync-gitcode cancel-in-progress: false jobs: sync: runs-on: ubuntu-latest env: GITCODE_REPO: Nwflower/Reims-Go GITCODE_USER: Nwflower steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Push main branch and tags to GitCode env: GITCODE_TOKEN: ${{ secrets.GITCODE_TOKEN }} run: | set -euo pipefail if [ -z "$GITCODE_TOKEN" ]; then echo "GITCODE_TOKEN secret is not configured; skipping." exit 0 fi git fetch --tags origin # Configure token via extraheader so it never appears in remote URLs/logs. auth="$(printf '%s:%s' "$GITCODE_USER" "$GITCODE_TOKEN" | base64 -w0)" git -c "http.extraheader=Authorization: Basic $auth" push "https://gitcode.com/${GITCODE_REPO}.git" HEAD:refs/heads/main git -c "http.extraheader=Authorization: Basic $auth" push "https://gitcode.com/${GITCODE_REPO}.git" --tags - name: Sync Release and assets to GitCode if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.sync_releases) env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITCODE_TOKEN: ${{ secrets.GITCODE_TOKEN }} GITHUB_REPO: ${{ github.repository }} TARGET_TAG: ${{ github.event.release.tag_name || inputs.tag }} run: | set -euo pipefail if [ -z "$GITCODE_TOKEN" ]; then echo "GITCODE_TOKEN secret is not configured; skipping release sync." exit 0 fi if [ -n "$TARGET_TAG" ]; then python3 scripts/sync-gitcode-release.py "$TARGET_TAG" else python3 scripts/sync-gitcode-release.py fi