-
Notifications
You must be signed in to change notification settings - Fork 1
Add GHA actions for download and verify checks #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
22a748c
66db758
54aaad4
3fefe6a
8604fdd
c319558
688be6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| name: Manual SCC Product Version Verification | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| product-name: | ||
| description: 'Product name to verify' | ||
| required: true | ||
| type: string | ||
| version: | ||
| description: 'Version to verify (e.g., v1.2.3 or 1.2.3-rc1)' | ||
| required: true | ||
| type: string | ||
| staging-code: | ||
| description: 'SCC staging registration code (optional - if not provided, staging verification is skipped)' | ||
| required: false | ||
| default: '' | ||
| production-code: | ||
| description: 'SCC production registration code (optional - if not provided, production verification is skipped)' | ||
| required: false | ||
| default: '' | ||
| fail-on-error: | ||
| description: 'Fail the workflow if verification fails' | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
|
|
||
| jobs: | ||
| verify: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Mask sensitive registration codes | ||
| shell: bash | ||
| run: | | ||
| if [ -n "${{ inputs.staging-code }}" ]; then | ||
| echo "::add-mask::${{ inputs.staging-code }}" | ||
| fi | ||
| if [ -n "${{ inputs.production-code }}" ]; then | ||
| echo "::add-mask::${{ inputs.production-code }}" | ||
| fi | ||
|
|
||
| - name: Checkout repository | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Download SCC Product Version Verifier | ||
| uses: ./actions/download | ||
|
|
||
| - name: Verify Product Version | ||
| uses: ./actions/verify | ||
| with: | ||
| product-name: ${{ inputs.product-name }} | ||
| version: ${{ inputs.version }} | ||
| staging-code: ${{ inputs.staging-code }} | ||
| production-code: ${{ inputs.production-code }} | ||
| fail-on-error: ${{ inputs.fail-on-error }} | ||
|
|
||
| - name: Verification Complete | ||
| shell: bash | ||
| run: | | ||
| echo "✅ Verification workflow completed" | ||
| echo "Check the step summary for detailed results" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| name: 'Setup SCC Product Version Verifier' | ||
| description: 'Downloads and prepares the SCC product version verifier CLI tool (Linux only)' | ||
| branding: | ||
| icon: 'check-circle' | ||
| color: 'green' | ||
|
|
||
| inputs: | ||
| version: | ||
| description: 'Release version to download (e.g., v1.2.3 or "latest")' | ||
| required: false | ||
| default: 'latest' | ||
| token: | ||
| description: 'GitHub token for API access' | ||
| required: false | ||
| default: ${{ github.token }} | ||
| output-dir: | ||
| description: 'Directory to extract downloaded files to' | ||
| required: false | ||
| default: './bin' | ||
|
|
||
| outputs: | ||
| version: | ||
| description: 'The release tag that was downloaded' | ||
| value: ${{ steps.release.outputs.tag }} | ||
| bin-path: | ||
| description: 'Path where binaries were extracted' | ||
| value: ${{ steps.download.outputs.bin-path }} | ||
| asset-name: | ||
| description: 'Name of the downloaded asset' | ||
| value: ${{ steps.download.outputs.asset-name }} | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Verify Linux | ||
| shell: bash | ||
| run: | | ||
| if [ "${{ runner.os }}" != "Linux" ]; then | ||
| echo "::error::This action only supports Linux runners" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Get release information | ||
| id: release | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ inputs.token }} | ||
| REPO: "rancherlabs/scc-product-version-verifier" | ||
| run: | | ||
| TAG="${{ inputs.version }}" | ||
| if [ "$TAG" == "latest" ] || [ -z "$TAG" ]; then | ||
| TAG=$(gh release view --repo "$REPO" --json tagName -q .tagName) | ||
| fi | ||
| echo "tag=$TAG" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Download and Extract | ||
| id: download | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ inputs.token }} | ||
| REPO: "rancherlabs/scc-product-version-verifier" | ||
|
Comment on lines
+48
to
+61
|
||
| BINARY_NAME: "scc-product-version-verifier" | ||
| run: | | ||
| ARCH="${{ runner.arch }}" | ||
| case "$ARCH" in | ||
| X64) | ||
| ARCH="x86_64" | ||
| ;; | ||
| ARM64) | ||
| ARCH="arm64" | ||
| ;; | ||
| X86|ARM) | ||
| echo "::error::Unsupported runner architecture: $ARCH. This action currently supports only X64 and ARM64 Linux runners." | ||
| exit 1 | ||
| ;; | ||
| *) | ||
| echo "::error::Unknown runner architecture: $ARCH" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| TAG="${{ steps.release.outputs.tag }}" | ||
| OUT="${{ inputs.output-dir }}" | ||
|
|
||
| mkdir -p "$OUT" | ||
|
|
||
| # 1. Download the archive | ||
| gh release download "$TAG" \ | ||
| --repo "$REPO" \ | ||
| --pattern "*Linux*${ARCH}*.tar.gz" \ | ||
| --dir "$OUT" \ | ||
| --clobber | ||
|
|
||
| # 2. Extract and identify the archive name for cleanup | ||
| ARCHIVE=$(find "$OUT" -maxdepth 1 -type f -name "*.tar.gz" -print -quit) | ||
| tar -xzf "$ARCHIVE" -C "$OUT" | ||
| rm "$ARCHIVE" | ||
|
|
||
| # 3. Ensure permissions | ||
| chmod +x "$OUT/$BINARY_NAME" | ||
|
|
||
| # 4. Set Outputs | ||
| echo "asset-name=$BINARY_NAME" >> $GITHUB_OUTPUT | ||
| echo "bin-path=$OUT" >> $GITHUB_OUTPUT | ||
|
|
||
| # 5. Add to PATH for immediate use | ||
| echo "$(realpath "$OUT")" >> $GITHUB_PATH | ||
|
|
||
| echo "✓ $BINARY_NAME is ready at $OUT/$BINARY_NAME" | ||
Uh oh!
There was an error while loading. Please reload this page.