mirror of
https://github.com/unraid/api.git
synced 2025-12-31 21:49:57 -06:00
fix: pr plugin promotion workflow (#1456)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Enhanced workflow to allow manual triggering with custom inputs. * Improved artifact handling and plugin file discovery for greater flexibility and reliability. * Added better error logging for missing plugin files during workflow execution. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
46
.github/workflows/push-staging-pr-on-close.yml
vendored
46
.github/workflows/push-staging-pr-on-close.yml
vendored
@@ -4,10 +4,21 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- closed
|
- closed
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
pr_number:
|
||||||
|
description: 'PR number to test with'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
pr_merged:
|
||||||
|
description: 'Simulate merged PR'
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
push-staging:
|
push-staging:
|
||||||
if: github.event.pull_request.merged == true
|
if: (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || (github.event_name == 'workflow_dispatch' && inputs.pr_merged == true)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -16,25 +27,36 @@ jobs:
|
|||||||
uses: szenius/set-timezone@v2.0
|
uses: szenius/set-timezone@v2.0
|
||||||
with:
|
with:
|
||||||
timezoneLinux: "America/Los_Angeles"
|
timezoneLinux: "America/Los_Angeles"
|
||||||
- name: Checkout repo
|
|
||||||
uses: actions/checkout@v4
|
- name: Set PR number
|
||||||
with:
|
id: pr_number
|
||||||
ref: refs/pull/${{ github.event.pull_request.base.ref }}/merge
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" == "pull_request" ]; then
|
||||||
|
echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "pr_number=${{ inputs.pr_number }}" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Download artifact
|
- name: Download artifact
|
||||||
uses: actions/download-artifact@v4
|
uses: dawidd6/action-download-artifact@v11
|
||||||
with:
|
with:
|
||||||
name: connect-files
|
name_is_regexp: true
|
||||||
|
name: unraid-plugin-.*
|
||||||
path: connect-files
|
path: connect-files
|
||||||
|
pr: ${{ steps.pr_number.outputs.pr_number }}
|
||||||
|
workflow_conclusion: success
|
||||||
|
|
||||||
- name: Update Downloaded Staging Plugin to New Date
|
- name: Update Downloaded Staging Plugin to New Date
|
||||||
run: |
|
run: |
|
||||||
if [ ! -f "connect-files/plugins/dynamix.unraid.net.pr.plg" ]; then
|
# Find the .plg file in the downloaded artifact
|
||||||
echo "ERROR: dynamix.unraid.net.pr.plg not found"
|
plgfile=$(find connect-files -name "*.plg" -type f | head -1)
|
||||||
|
if [ ! -f "$plgfile" ]; then
|
||||||
|
echo "ERROR: .plg file not found in connect-files/"
|
||||||
|
ls -la connect-files/
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
plgfile="connect-files/plugins/dynamix.unraid.net.pr.plg"
|
echo "Found plugin file: $plgfile"
|
||||||
version=$(date +"%Y.%m.%d.%H%M")
|
version=$(date +"%Y.%m.%d.%H%M")
|
||||||
sed -i -E "s#(<!ENTITY version \").*(\">)#\1${version}\2#g" "${plgfile}" || exit 1
|
sed -i -E "s#(<!ENTITY version \").*(\">)#\1${version}\2#g" "${plgfile}" || exit 1
|
||||||
|
|
||||||
@@ -54,4 +76,4 @@ jobs:
|
|||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_SECRET_ACCESS_KEY }}
|
||||||
AWS_REGION: "auto"
|
AWS_REGION: "auto"
|
||||||
SOURCE_DIR: pr-release
|
SOURCE_DIR: pr-release
|
||||||
DEST_DIR: unraid-api/pr/${{ github.event.pull_request.number }}
|
DEST_DIR: unraid-api/tag/PR${{ steps.pr_number.outputs.pr_number }}
|
||||||
|
|||||||
Reference in New Issue
Block a user