Skip to content

Create_Release_Draft #20

Create_Release_Draft

Create_Release_Draft #20

name: Create_Release_Draft
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install tools
run: |
sudo apt-get install gh
sudo apt-get install jq
- name: Get latest run ID for Linux_AppImage
id: get_linux_run_id
run: |
latest_run=$(gh run list --workflow=Linux_AppImage --json databaseId,conclusion --jq '.[0]')
linux_run_id=$(echo $latest_run | jq -r .databaseId)
echo "linux_run_id=$linux_run_id" >> $GITHUB_ENV
conclusion=$(echo $latest_run | jq -r .conclusion)
if [ "$conclusion" != "success" ]; then
echo "Latest Linux_AppImage workflow run failed."
exit 1
fi
env:
GH_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
- name: Get latest run ID for Windows_MSI
id: get_windows_run_id
run: |
latest_run=$(gh run list --workflow=Windows_MSI --json databaseId,conclusion --jq '.[0]')
windows_run_id=$(echo $latest_run | jq -r .databaseId)
echo "windows_run_id=$windows_run_id" >> $GITHUB_ENV
conclusion=$(echo $latest_run | jq -r .conclusion)
if [ "$conclusion" != "success" ]; then
echo "Latest Windows_MSI workflow run failed."
exit 1
fi
env:
GH_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
- name: Download Linux_AppImage artifact
run: |
mkdir -p artifacts
echo "Downloading artifacts from run ID: ${{ env.linux_run_id }}..."
gh run download ${{ env.linux_run_id }} -D artifacts
echo "Artifacts downloaded to artifacts directory."
env:
GH_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
- name: Download Windows_MSI artifact
run: |
mkdir -p artifacts
echo "Downloading artifacts from run ID: ${{ env.windows_run_id }}..."
gh run download ${{ env.windows_run_id }} -D artifacts
echo "Artifacts downloaded to artifacts directory."
env:
GH_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
- name: Read version
id: get_version
run: |
version=$(grep -oP 'set\(PDF4QT_VERSION \K[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' "CMakeLists.txt")
echo "Version: $version"
echo "pdf4qt_version=$version" >> $GITHUB_ENV
- name: List all files recursively
run: |
echo "Listing all files in artifacts:"
ls -R artifacts
- name: Prepare file list for release
id: prepare_files
run: |
ALL_FILES=$(find artifacts -type f | tr '\n' ' ')
echo "files=$ALL_FILES" >> $GITHUB_ENV
- name: Debug file list
run: |
echo "Files to be uploaded: ${{ env.files }}"
- name: Create Release Draft
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: 'v${{ env.pdf4qt_version }}'
name: "Release of PDF4QT ${{ env.pdf4qt_version }} (Draft)"
draft: true
prerelease: false
generate_release_notes: true
token: ${{ secrets.MY_GITHUB_TOKEN }}
fail_on_unmatched_files: true
files: |
${{ env.files }}