This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-actions.git


The following commit(s) were added to refs/heads/main by this push:
     new 0613f93  Add an action to record distributions on the ATR
0613f93 is described below

commit 0613f93144f101a63529a380a1a1a031081da4a0
Author: Sean B. Palmer <[email protected]>
AuthorDate: Mon Sep 8 19:10:44 2025 +0100

    Add an action to record distributions on the ATR
---
 record-atr-distribution/action.yml | 79 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

diff --git a/record-atr-distribution/action.yml 
b/record-atr-distribution/action.yml
new file mode 100644
index 0000000..80894a6
--- /dev/null
+++ b/record-atr-distribution/action.yml
@@ -0,0 +1,79 @@
+---
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: "Record distribution on ATR using a GitHub OIDC JWT"
+description: "Record a distribution on ATR using a GitHub OIDC JWT."
+branding: {icon: upload-cloud, color: blue}
+
+inputs:
+  version: {description: "Release version", required: true}
+  platform: {description: "Distribution platform (documented in the ATR API)", 
required: true}
+  distribution-owner-namespace: {description: "Owner namespace", default: ""}
+  distribution-package: {description: "Distribution package", required: true}
+  distribution-version: {description: "Distribution version", required: true}
+  staging: {description: "Use staging (true or false)", default: "false"}
+  details: {description: "Include detailed check (true or false)", default: 
"false"}
+  atr-host: {description: "ATR host", default: "release-test.apache.org"}
+
+runs:
+  using: "composite"
+  steps:
+    - name: Create a GitHub OIDC JWT
+      id: create-github-jwt
+      shell: bash
+      run: |
+        set -euo pipefail
+        url="${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=atr-test-v1"
+        jwt="$(curl -sS --fail-with-body -H "Authorization: bearer 
${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" "$url" | jq -r .value)"
+        echo "::add-mask::$jwt"
+        echo "jwt=$jwt" >> "$GITHUB_OUTPUT"
+
+    - name: Record distribution on ATR
+      shell: bash
+      run: |
+        set -euxo pipefail
+        case "${INPUTS_ATR_HOST}" in
+          *.apache.org) ;;
+          *) echo "atr-host must match *.apache.org"; exit 1;;
+        esac
+        STAGING_JSON=false
+        [ "${INPUTS_STAGING}" = "true" ] && STAGING_JSON=true
+        DETAILS_JSON=false
+        [ "${INPUTS_DETAILS}" = "true" ] && DETAILS_JSON=true
+        jq -n --arg publisher github \
+              --arg jwt "$JWT" \
+              --arg version "$INPUTS_VERSION" \
+              --arg platform "$INPUTS_PLATFORM" \
+              --arg distribution_owner_namespace 
"$INPUTS_DISTRIBUTION_OWNER_NAMESPACE" \
+              --arg distribution_package "$INPUTS_DISTRIBUTION_PACKAGE" \
+              --arg distribution_version "$INPUTS_DISTRIBUTION_VERSION" \
+              --argjson staging "$STAGING_JSON" \
+              --argjson details "$DETAILS_JSON" \
+              '{publisher:$publisher, jwt:$jwt, version:$version, 
platform:$platform, distribution_owner_namespace:$distribution_owner_namespace, 
distribution_package:$distribution_package, 
distribution_version:$distribution_version, staging:$staging, 
details:$details}' |
+          curl -sS --fail-with-body -X POST -H 'Content-Type: 
application/json' -d @- \
+            "https://${INPUTS_ATR_HOST}/api/publisher/distribution/record";
+      env:
+        INPUTS_ATR_HOST: ${{ inputs.atr-host }}
+        INPUTS_VERSION: ${{ inputs.version }}
+        INPUTS_PLATFORM: ${{ inputs.platform }}
+        INPUTS_DISTRIBUTION_OWNER_NAMESPACE: ${{ 
inputs.distribution-owner-namespace }}
+        INPUTS_DISTRIBUTION_PACKAGE: ${{ inputs.distribution-package }}
+        INPUTS_DISTRIBUTION_VERSION: ${{ inputs.distribution-version }}
+        INPUTS_STAGING: ${{ inputs.staging }}
+        INPUTS_DETAILS: ${{ inputs.details }}
+        JWT: ${{ steps.create-github-jwt.outputs.jwt }}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to