fix(renovate): Preserve version of upstream image #248
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Mirror GitLab Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag to mirror (e.g. v1.2.3)' | |
| required: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| mirror-release: | |
| runs-on: ubuntu-latest | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Mirror release from GitLab | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| TAG_NAME="${{ inputs.tag }}" | |
| if test -z "$TAG_NAME"; then | |
| TAG_NAME="${GITHUB_REF_NAME}" | |
| fi | |
| if [[ ! $TAG_NAME =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "ERROR: Invalid tag name '$TAG_NAME'. Expected format: vX.Y.Z" | |
| exit 1 | |
| fi | |
| echo "Using tag name: $TAG_NAME" | |
| echo "Fetching GitLab release for tag: $TAG_NAME" | |
| if ! curl --silent --show-error --location --fail --output release.json --retry 10 --retry-delay 180 --retry-max-time 1800 "https://gitlab.com/api/v4/projects/uniget-org%2fcli/releases/${TAG_NAME}"; then | |
| echo "ERROR: Failed to fetch GitLab release for tag <$TAG_NAME>." | |
| exit 1 | |
| fi | |
| title="$(jq -r '.name // .tag_name' release.json)" | |
| notes_file=release_notes.md | |
| { | |
| echo "Mirrored from GitLab: https://gitlab.com/uniget-org/cli/-/releases/${TAG_NAME}" | |
| echo | |
| jq -r '.description // ""' release.json | |
| } >"${notes_file}" | |
| if gh release view "${TAG_NAME}" >/dev/null 2>&1; then | |
| echo "Updating existing GitHub release ${TAG_NAME}" | |
| gh release edit "${TAG_NAME}" --title "${title}" --notes-file "${notes_file}" | |
| else | |
| echo "Creating GitHub release ${TAG_NAME}" | |
| gh release create "${TAG_NAME}" --title "${title}" --notes-file "${notes_file}" | |
| fi |