[build]correct terminology run_id to run_number and fix usage
parent
f346e830ff
commit
dfb216c367
|
|
@ -3,10 +3,9 @@ name: Deploy Viewer
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
build_run_id:
|
build_run_number:
|
||||||
description: 'Workflow Run ID of the build to deploy'
|
description: 'GitHub Run Number (per build_viewer.yml workflow)'
|
||||||
required: true
|
required: true
|
||||||
default: ''
|
|
||||||
viewer_channel:
|
viewer_channel:
|
||||||
description: 'viewer_channel'
|
description: 'viewer_channel'
|
||||||
required: true
|
required: true
|
||||||
|
|
@ -50,7 +49,7 @@ jobs:
|
||||||
id: download
|
id: download
|
||||||
with:
|
with:
|
||||||
workflow: build_viewer.yml
|
workflow: build_viewer.yml
|
||||||
run_number: ${{ github.event.inputs.build_run_id }}
|
run_number: ${{ github.event.inputs.build_run_number }}
|
||||||
path: to_deploy
|
path: to_deploy
|
||||||
- name: Install discord-webhook library
|
- name: Install discord-webhook library
|
||||||
run: pip install discord-webhook
|
run: pip install discord-webhook
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ name: Tag FS Build
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
build_run_id:
|
build_run_number:
|
||||||
description: 'GitHub Run ID'
|
description: 'GitHub Run Number (per build_viewer.yml workflow)'
|
||||||
required: true
|
required: true
|
||||||
release_type:
|
release_type:
|
||||||
description: "type of build"
|
description: "type of build"
|
||||||
|
|
@ -36,17 +36,61 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Step 1: Checkout the Repository
|
# Checkout the Repository
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Necessary to fetch all history for tagging
|
fetch-depth: 0 # Necessary to fetch all history for tagging
|
||||||
|
|
||||||
# Step 2: Install jq for JSON Parsing
|
# Install jq for JSON Parsing
|
||||||
- name: Install jq
|
- name: Install jq
|
||||||
run: sudo apt-get update && sudo apt-get install -y jq
|
run: sudo apt-get update && sudo apt-get install -y jq
|
||||||
|
|
||||||
# Step 3: Retrieve Run Information
|
# List Workflow Runs and Find run_id
|
||||||
|
- name: Find run_id from run_number
|
||||||
|
id: find_run_id
|
||||||
|
uses: octokit/request-action@v2.x
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
route: GET /repos/{owner}/{repo}/actions/workflows/build_viewer.yml/runs
|
||||||
|
owner: ${{ github.repository_owner }}
|
||||||
|
repo: ${{ github.event.repository.name }}
|
||||||
|
continue-on-error: false
|
||||||
|
|
||||||
|
# Extract run_id based on run_number
|
||||||
|
- name: Extract run_id
|
||||||
|
id: extract_run_id
|
||||||
|
run: |
|
||||||
|
run_number=${{ github.event.inputs.build_run_number }}
|
||||||
|
echo "Searching for run_number: $run_number"
|
||||||
|
|
||||||
|
# Parse the JSON response to find the run with the matching run_number
|
||||||
|
run_id=$(echo '${{ steps.find_run_id.outputs.data }}' | jq -r --arg RUN_NUMBER "$run_number" '.workflow_runs[] | select(.run_number == ($RUN_NUMBER | tonumber)) | .id')
|
||||||
|
|
||||||
|
if [ -z "$run_id" ]; then
|
||||||
|
echo "Error: No run found with run_number: $run_number"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Found run_id: $run_id"
|
||||||
|
echo "run_id=$run_id" >> $GITHUB_OUTPUT
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
# Retrieve Run Information Using run_id
|
||||||
|
- name: Get run info
|
||||||
|
id: get_run_info
|
||||||
|
uses: octokit/request-action@v2.x
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
route: GET /repos/{owner}/{repo}/actions/runs/{run_id}
|
||||||
|
owner: ${{ github.repository_owner }}
|
||||||
|
repo: ${{ github.event.repository.name }}
|
||||||
|
run_id: ${{ steps.extract_run_id.outputs.run_id }}
|
||||||
|
continue-on-error: false
|
||||||
|
|
||||||
|
# Retrieve Run Information
|
||||||
- name: Get run info
|
- name: Get run info
|
||||||
id: get_run_info
|
id: get_run_info
|
||||||
uses: octokit/request-action@v2.x
|
uses: octokit/request-action@v2.x
|
||||||
|
|
@ -56,9 +100,9 @@ jobs:
|
||||||
route: GET /repos/{owner}/{repo}/actions/runs/{run_id}
|
route: GET /repos/{owner}/{repo}/actions/runs/{run_id}
|
||||||
owner: ${{ github.repository_owner }}
|
owner: ${{ github.repository_owner }}
|
||||||
repo: ${{ github.event.repository.name }}
|
repo: ${{ github.event.repository.name }}
|
||||||
run_id: ${{ github.event.inputs.build_run_id }}
|
run_id: ${{ github.event.inputs.build_run_number }}
|
||||||
|
|
||||||
# Step 4: Extract Commit SHA and Branch from Run Info
|
# Extract Commit SHA and Branch from Run Info
|
||||||
- name: Extract commit SHA and branch
|
- name: Extract commit SHA and branch
|
||||||
id: extract_info
|
id: extract_info
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -68,7 +112,7 @@ jobs:
|
||||||
echo "branch=$branch" >> $GITHUB_OUTPUT
|
echo "branch=$branch" >> $GITHUB_OUTPUT
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
# Step 4.1: (Optional) Check if Tag Already Exists
|
# Check if Tag Already Exists
|
||||||
- name: Check if tag exists
|
- name: Check if tag exists
|
||||||
id: check_tag
|
id: check_tag
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -82,11 +126,11 @@ jobs:
|
||||||
fi
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
# Step 5: Checkout the Specific Commit
|
# Checkout the Specific Commit
|
||||||
- name: Checkout the specific commit
|
- name: Checkout the specific commit
|
||||||
run: git checkout ${{ steps.extract_info.outputs.commit_sha }}
|
run: git checkout ${{ steps.extract_info.outputs.commit_sha }}
|
||||||
|
|
||||||
# Step 6: Create the Tag (Conditional)
|
# Create the Tag (Conditional)
|
||||||
- name: Create tag
|
- name: Create tag
|
||||||
id: create_tag
|
id: create_tag
|
||||||
if: ${{ inputs.dry_run != 'true' && steps.check_tag.outputs.tag_exists == 'false' }}
|
if: ${{ inputs.dry_run != 'true' && steps.check_tag.outputs.tag_exists == 'false' }}
|
||||||
|
|
@ -97,7 +141,7 @@ jobs:
|
||||||
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT
|
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
# Step 7: Push the Tag to the Repository (Conditional)
|
# Push the Tag to the Repository (Conditional)
|
||||||
- name: Push tag
|
- name: Push tag
|
||||||
if: ${{ inputs.dry_run != 'true' && steps.check_tag.outputs.tag_exists == 'false' }}
|
if: ${{ inputs.dry_run != 'true' && steps.check_tag.outputs.tag_exists == 'false' }}
|
||||||
env:
|
env:
|
||||||
|
|
@ -105,7 +149,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
git push origin ${{ steps.create_tag.outputs.TAG_NAME }}
|
git push origin ${{ steps.create_tag.outputs.TAG_NAME }}
|
||||||
|
|
||||||
# Step 8: Output Dry Run or Tag Creation Message
|
# Output Dry Run or Tag Creation Message
|
||||||
- name: Tagging Confirmation
|
- name: Tagging Confirmation
|
||||||
run: |
|
run: |
|
||||||
TAG_NAME="Firestorm_${{ github.event.inputs.release_type }}_${{ github.event.inputs.viewer_version }}.${{ github.event.inputs.viewer_build }}"
|
TAG_NAME="Firestorm_${{ github.event.inputs.release_type }}_${{ github.event.inputs.viewer_version }}.${{ github.event.inputs.viewer_build }}"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue