|
| 1 | +name: PCD README update |
| 2 | + |
| 3 | +on: |
| 4 | + repository_dispatch: |
| 5 | + types: [pcd-published] |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + tag: |
| 9 | + description: "Release tag on the private repo, e.g. 20260319-cd" |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + private_repo: |
| 13 | + description: "Private repo, e.g. SMPTE/tst123-4-private" |
| 14 | + required: true |
| 15 | + type: string |
| 16 | + end_1: |
| 17 | + description: "Review ends no earlier than (YYYY-MM-DD)" |
| 18 | + required: true |
| 19 | + type: string |
| 20 | + end_2: |
| 21 | + description: "Review ends no later than (YYYY-MM-DD)" |
| 22 | + required: true |
| 23 | + type: string |
| 24 | + message: |
| 25 | + description: "Details/marketing message (multi-line allowed)" |
| 26 | + required: false |
| 27 | + type: string |
| 28 | + default: "" |
| 29 | + |
| 30 | +jobs: |
| 31 | + resolve: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + outputs: |
| 34 | + tag: ${{ steps.fields.outputs.tag }} |
| 35 | + release_url: ${{ steps.fields.outputs.release_url }} |
| 36 | + doc_url: ${{ steps.fields.outputs.doc_url }} |
| 37 | + private_repo: ${{ steps.fields.outputs.private_repo }} |
| 38 | + private_repo_name: ${{ steps.fields.outputs.private_repo_name }} |
| 39 | + public_repo: ${{ steps.fields.outputs.public_repo }} |
| 40 | + public_repo_name: ${{ steps.fields.outputs.public_repo_name }} |
| 41 | + end_1: ${{ steps.fields.outputs.end_1 }} |
| 42 | + end_2: ${{ steps.fields.outputs.end_2 }} |
| 43 | + message: ${{ steps.fields.outputs.message }} |
| 44 | + steps: |
| 45 | + - name: Derive fields |
| 46 | + id: fields |
| 47 | + env: |
| 48 | + EVENT_NAME: ${{ github.event_name }} |
| 49 | + PAYLOAD_TAG: ${{ github.event.client_payload.tag }} |
| 50 | + PAYLOAD_RELEASE_URL: ${{ github.event.client_payload.release_url }} |
| 51 | + PAYLOAD_DOC_URL: ${{ github.event.client_payload.doc_url }} |
| 52 | + PAYLOAD_PRIVATE_REPO: ${{ github.event.client_payload.private_repo }} |
| 53 | + PAYLOAD_PUBLIC_REPO: ${{ github.event.client_payload.public_repo }} |
| 54 | + PAYLOAD_END_1: ${{ github.event.client_payload.end_1 }} |
| 55 | + PAYLOAD_END_2: ${{ github.event.client_payload.end_2 }} |
| 56 | + PAYLOAD_MESSAGE: ${{ github.event.client_payload.message }} |
| 57 | + INPUT_TAG: ${{ inputs.tag }} |
| 58 | + INPUT_PRIVATE_REPO: ${{ inputs.private_repo }} |
| 59 | + INPUT_END_1: ${{ inputs.end_1 }} |
| 60 | + INPUT_END_2: ${{ inputs.end_2 }} |
| 61 | + INPUT_MESSAGE: ${{ inputs.message }} |
| 62 | + GITHUB_REPO: ${{ github.repository }} |
| 63 | + run: | |
| 64 | + if [[ "$EVENT_NAME" == "repository_dispatch" ]]; then |
| 65 | + TAG="$PAYLOAD_TAG" |
| 66 | + RELEASE_URL="$PAYLOAD_RELEASE_URL" |
| 67 | + DOC_URL="$PAYLOAD_DOC_URL" |
| 68 | + PRIVATE_REPO="$PAYLOAD_PRIVATE_REPO" |
| 69 | + PUBLIC_REPO="$PAYLOAD_PUBLIC_REPO" |
| 70 | + END_1="$PAYLOAD_END_1" |
| 71 | + END_2="$PAYLOAD_END_2" |
| 72 | + MESSAGE="$PAYLOAD_MESSAGE" |
| 73 | + else |
| 74 | + TAG="$INPUT_TAG" |
| 75 | + PRIVATE_REPO="$INPUT_PRIVATE_REPO" |
| 76 | + PUBLIC_REPO="$GITHUB_REPO" |
| 77 | + RELEASE_URL="https://github.com/${PRIVATE_REPO}/releases/tag/${TAG}" |
| 78 | + DOC_URL="https://doc.smpte-doc.org/${PRIVATE_REPO#*/}/${TAG}/" |
| 79 | + END_1="$INPUT_END_1" |
| 80 | + END_2="$INPUT_END_2" |
| 81 | + MESSAGE="$INPUT_MESSAGE" |
| 82 | + fi |
| 83 | + PRIVATE_REPO_NAME="${PRIVATE_REPO#*/}" |
| 84 | + PUBLIC_REPO_NAME="${PUBLIC_REPO#*/}" |
| 85 | +
|
| 86 | + { |
| 87 | + echo "tag=$TAG" |
| 88 | + echo "release_url=$RELEASE_URL" |
| 89 | + echo "doc_url=$DOC_URL" |
| 90 | + echo "private_repo=$PRIVATE_REPO" |
| 91 | + echo "private_repo_name=$PRIVATE_REPO_NAME" |
| 92 | + echo "public_repo=$PUBLIC_REPO" |
| 93 | + echo "public_repo_name=$PUBLIC_REPO_NAME" |
| 94 | + echo "end_1=$END_1" |
| 95 | + echo "end_2=$END_2" |
| 96 | + } >> "$GITHUB_OUTPUT" |
| 97 | +
|
| 98 | + # Multi-line message uses GITHUB_OUTPUT heredoc syntax |
| 99 | + DELIMITER="EOF_$(date +%s)_$$" |
| 100 | + { |
| 101 | + echo "message<<${DELIMITER}" |
| 102 | + printf '%s\n' "$MESSAGE" |
| 103 | + echo "${DELIMITER}" |
| 104 | + } >> "$GITHUB_OUTPUT" |
| 105 | +
|
| 106 | + update: |
| 107 | + needs: resolve |
| 108 | + permissions: |
| 109 | + contents: write |
| 110 | + pull-requests: write |
| 111 | + uses: SMPTE/html-pub/.github/workflows/pcd-update-reusable.yml@main |
| 112 | + with: |
| 113 | + tag: ${{ needs.resolve.outputs.tag }} |
| 114 | + release_url: ${{ needs.resolve.outputs.release_url }} |
| 115 | + doc_url: ${{ needs.resolve.outputs.doc_url }} |
| 116 | + private_repo: ${{ needs.resolve.outputs.private_repo }} |
| 117 | + private_repo_name: ${{ needs.resolve.outputs.private_repo_name }} |
| 118 | + public_repo: ${{ needs.resolve.outputs.public_repo }} |
| 119 | + public_repo_name: ${{ needs.resolve.outputs.public_repo_name }} |
| 120 | + end_1: ${{ needs.resolve.outputs.end_1 }} |
| 121 | + end_2: ${{ needs.resolve.outputs.end_2 }} |
| 122 | + message: ${{ needs.resolve.outputs.message }} |
0 commit comments