|
| 1 | +on: |
| 2 | + workflow_dispatch: |
| 3 | + inputs: |
| 4 | + version: |
| 5 | + required: true |
| 6 | + type: string |
| 7 | + |
| 8 | +jobs: |
| 9 | + promote: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + - uses: ./.github/actions/cn_release |
| 14 | + id: cn-show |
| 15 | + with: |
| 16 | + key: ${{ secrets.CN_API_KEY }} |
| 17 | + raw: >- |
| 18 | + release show fastrepl/hyprnote ${{ inputs.version }} --channel nightly |
| 19 | +
|
| 20 | + - name: Parse and download assets |
| 21 | + id: assets |
| 22 | + run: | |
| 23 | + echo "Nightly release details: ${{ steps.cn-show.outputs.raw }}" |
| 24 | +
|
| 25 | + mkdir -p assets |
| 26 | + cd assets |
| 27 | +
|
| 28 | + # Clean previous asset info file |
| 29 | + > ../asset_info.txt |
| 30 | +
|
| 31 | + echo '${{ steps.cn-show.outputs.raw }}' | jq -c '.assets[]' | while read -r asset; do |
| 32 | + asset_id=$(jq -r '.id' <<< "$asset") |
| 33 | + update_platform=$(jq -r '.updatePlatform' <<< "$asset") |
| 34 | + public_platform=$(jq -r '.publicPlatform' <<< "$asset") |
| 35 | + filename=$(jq -r '.filename' <<< "$asset") |
| 36 | + signature=$(jq -r '.signature' <<< "$asset") |
| 37 | +
|
| 38 | + # Download the asset |
| 39 | + curl "https://cdn.crabnebula.app/asset/$asset_id" --output "$filename" |
| 40 | +
|
| 41 | + # Save signature to .sig file if it exists |
| 42 | + if [ "$signature" != "null" ]; then |
| 43 | + echo "$signature" > "$filename.sig" |
| 44 | + fi |
| 45 | +
|
| 46 | + # Store file info for later use |
| 47 | + echo "$filename,$update_platform,$public_platform" >> ../asset_info.txt |
| 48 | + done |
| 49 | +
|
| 50 | + cd .. |
| 51 | + echo "downloaded=true" >> $GITHUB_OUTPUT |
| 52 | +
|
| 53 | + - uses: ./.github/actions/cn_release |
| 54 | + with: |
| 55 | + key: ${{ secrets.CN_API_KEY }} |
| 56 | + raw: >- |
| 57 | + release draft fastrepl/hyprnote ${{ inputs.version }} |
| 58 | +
|
| 59 | + - name: Upload assets |
| 60 | + id: upload_assets |
| 61 | + run: | |
| 62 | + cd assets |
| 63 | + # Upload each asset individually |
| 64 | + while IFS=, read -r filename update_platform public_platform; do |
| 65 | + # Build command arguments array properly |
| 66 | + args=("release" "upload" "fastrepl/hyprnote" "${{ inputs.version }}" "--file" "$filename") |
| 67 | +
|
| 68 | + if [ "$update_platform" != "null" ]; then |
| 69 | + args+=("--update-platform" "$update_platform") |
| 70 | +
|
| 71 | + # Point directly to the signature file |
| 72 | + if [ -f "$filename.sig" ]; then |
| 73 | + args+=("--signature" "$filename.sig") |
| 74 | + fi |
| 75 | + fi |
| 76 | +
|
| 77 | + if [ "$public_platform" != "null" ]; then |
| 78 | + args+=("--public-platform" "$public_platform") |
| 79 | + fi |
| 80 | +
|
| 81 | + echo "Uploading $filename with command: ${args[*]}" |
| 82 | + ../cn "${args[@]}" |
| 83 | + done < ../asset_info.txt |
| 84 | + env: |
| 85 | + CN_API_KEY: ${{ secrets.CN_API_KEY }} |
| 86 | + |
| 87 | + - uses: ./.github/actions/cn_release |
| 88 | + with: |
| 89 | + key: ${{ secrets.CN_API_KEY }} |
| 90 | + raw: >- |
| 91 | + release publish fastrepl/hyprnote ${{ inputs.version }} |
0 commit comments