Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/notify-downstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Place in: jfrog/jfrog-cli -> .github/workflows/notify-downstream.yml
name: Notify downstream repos of new CLI release
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: "CLI version to announce (X.Y.Z, no leading v); blank = latest release"
required: false

permissions:
contents: read

jobs:
notify:
if: github.event_name == 'workflow_dispatch' || (!github.event.release.prerelease && !github.event.release.draft)
runs-on: ubuntu-latest
steps:
- name: Resolve version
id: v
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.event.release.tag_name }}
INPUT: ${{ inputs.version }}
run: |
VERSION="${INPUT:-${TAG#v}}"
[ -n "$VERSION" ] || VERSION="$(gh api repos/${{ github.repository }}/releases/latest --jq .tag_name | sed 's/^v//')"
if ! [[ "$VERSION" =~ ^2\.[0-9]+\.[0-9]+$ ]]; then
echo "Not a stable v2 release ($VERSION), skipping."
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Wait until binaries are downloadable
if: steps.v.outputs.skip != 'true'
env:
VERSION: ${{ steps.v.outputs.version }}
run: |
BASE="https://releases.jfrog.io/artifactory/jfrog-cli/v2-jf/$VERSION"
for url in "$BASE/jfrog-cli-linux-amd64/jf" "$BASE/jfrog-cli-windows-amd64/jf.exe" "$BASE/jfrog-cli-mac-386/jf"; do
for i in $(seq 1 30); do
code=$(curl -s -o /dev/null -w '%{http_code}' -I -L "$url")
[ "$code" = "200" ] && break
echo "[$i/30] $url -> $code, retrying in 60s"; sleep 60
done
[ "$code" = "200" ] || { echo "::error::$url never became available"; exit 1; }
done

- name: Dispatch to downstream repos
if: steps.v.outputs.skip != 'true'
env:
GH_TOKEN: ${{ secrets.CLI_ACTION_TOKEN }}
VERSION: ${{ steps.v.outputs.version }}
run: |
for repo in jfrog/setup-jfrog-cli jfrog/jfrog-azure-devops-extension; do
gh api "repos/$repo/dispatches" -f event_type=cli-released -f "client_payload[version]=$VERSION"
done
Loading