|
| 1 | +name: Package with Conveyor |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + platform: |
| 7 | + description: 'Target platform' |
| 8 | + required: true |
| 9 | + default: 'windows' |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - windows |
| 13 | + - mac |
| 14 | + - linux |
| 15 | + arch: |
| 16 | + description: 'Architecture (for macOS only)' |
| 17 | + required: false |
| 18 | + type: choice |
| 19 | + options: |
| 20 | + - mac.amd64 |
| 21 | + - mac.aarch64 |
| 22 | + workflow_call: |
| 23 | + inputs: |
| 24 | + platform: |
| 25 | + description: 'Target platform' |
| 26 | + required: false |
| 27 | + default: 'windows' |
| 28 | + type: string |
| 29 | + arch: |
| 30 | + description: 'Architecture (for macOS only: mac.amd64 or mac.aarch64)' |
| 31 | + required: false |
| 32 | + type: string |
| 33 | + secrets: |
| 34 | + CONVEYOR_ROOT_KEY: |
| 35 | + required: false |
| 36 | + APPLE_SIGNING_KEY: |
| 37 | + required: false |
| 38 | + APPLE_SIGNING_P12_ENCODED: |
| 39 | + required: false |
| 40 | + MAC_NOTARY_ISSUER: |
| 41 | + required: false |
| 42 | + MAC_NOTARY_KEY: |
| 43 | + required: false |
| 44 | + MAC_NOTARY_PRIVATE_KEY_ENCODED: |
| 45 | + required: false |
| 46 | + |
| 47 | +jobs: |
| 48 | + package: |
| 49 | + runs-on: ubuntu-latest |
| 50 | + permissions: |
| 51 | + contents: read |
| 52 | + |
| 53 | + steps: |
| 54 | + - name: Checkout code |
| 55 | + uses: actions/checkout@v4 |
| 56 | + with: |
| 57 | + submodules: recursive |
| 58 | + |
| 59 | + - name: Download JAR artifact |
| 60 | + uses: actions/download-artifact@v4 |
| 61 | + with: |
| 62 | + name: behave7-jar |
| 63 | + path: projects/behave/target/ |
| 64 | + |
| 65 | + |
| 66 | + #### WINDOWS SIGNING #### |
| 67 | + - name: Build package with Conveyor |
| 68 | + uses: hydraulic-software/conveyor/actions/build@v21.1 |
| 69 | + if: ${{ contains(inputs.platform || 'windows-zip', 'windows') }} |
| 70 | + with: |
| 71 | + signing_key: ${{ secrets.CONVEYOR_ROOT_KEY }} |
| 72 | + agree_to_license: 1 |
| 73 | + command: make windows-zip |
| 74 | + extra_flags: -f projects/behave/conveyor.windows-ci.conf |
| 75 | + |
| 76 | + |
| 77 | + #### APPLE SIGNING #### |
| 78 | + - name: Setup Apple certificate for macOS Signing / Notarization |
| 79 | + if: ${{ contains(inputs.platform || '', 'mac') }} |
| 80 | + env: |
| 81 | + APPLE_SIGNING_P12_ENCODED: ${{ secrets.APPLE_SIGNING_P12_ENCODED }} |
| 82 | + MAC_NOTARY_PRIVATE_KEY_ENCODED: ${{ secrets.MAC_NOTARY_PRIVATE_KEY_ENCODED }} |
| 83 | + run: | |
| 84 | + cd ${{ github.workspace }} |
| 85 | + mkdir -p projects/behave/.env |
| 86 | +
|
| 87 | + # Decode and save the P12 Certificate |
| 88 | + echo "${{ env.APPLE_SIGNING_P12_ENCODED }}" | base64 --decode > ${{ github.workspace }}/projects/behave/.env/apple.p12 |
| 89 | + echo "APPLE_SIGNING_KEY_PATH=${{ github.workspace }}/projects/behave/.env/apple.p12" >> $GITHUB_ENV |
| 90 | +
|
| 91 | + # Decode and save the P8 Notary |
| 92 | + echo "${{ env.MAC_NOTARY_PRIVATE_KEY_ENCODED }}" | base64 --decode > ${{ github.workspace }}//projects/behave/.env/AuthKey.p8 |
| 93 | + echo "MAC_NOTARY_PRIVATE_KEY_PATH=${{ github.workspace }}/projects/behave/.env/AuthKey.p8" >> $GITHUB_ENV |
| 94 | +
|
| 95 | + - name: Build package with Conveyor |
| 96 | + if: ${{ contains(inputs.platform || '', 'mac') }} |
| 97 | + uses: hydraulic-software/conveyor/actions/build@v21.1 |
| 98 | + env: |
| 99 | + APPLE_SIGNING_KEY: ${{ secrets.APPLE_SIGNING_KEY }} |
| 100 | + MAC_NOTARY_ISSUER: ${{ secrets.MAC_NOTARY_ISSUER }} |
| 101 | + MAC_NOTARY_KEY: ${{ secrets.MAC_NOTARY_KEY }} |
| 102 | + with: |
| 103 | + signing_key: ${{ secrets.CONVEYOR_ROOT_KEY }} |
| 104 | + agree_to_license: 1 |
| 105 | + command: make notarized-mac-zip |
| 106 | + extra_flags: -f projects/behave/conveyor.macos-ci.conf ${{ inputs.arch && format('-Kapp.machines={0}', inputs.arch) || '' }} |
| 107 | + |
| 108 | + |
| 109 | + #### LINUX SIGNING #### |
| 110 | + - name: Build package with Conveyor |
| 111 | + if: ${{ contains(inputs.platform || '', 'linux') }} |
| 112 | + uses: hydraulic-software/conveyor/actions/build@v21.1 |
| 113 | + with: |
| 114 | + signing_key: ${{ secrets.CONVEYOR_ROOT_KEY }} |
| 115 | + agree_to_license: 1 |
| 116 | + command: make debian-package |
| 117 | + extra_flags: -f projects/behave/conveyor.linux-ci.conf |
| 118 | + |
| 119 | + - name: Ensure version has v prefix in filename |
| 120 | + run: | |
| 121 | + find output -name "*.zip" -type f | while read -r file; do |
| 122 | + dir=$(dirname "$file") |
| 123 | + name=$(basename "$file") |
| 124 | +
|
| 125 | + # Check if filename has a version without v prefix (e.g., name-1.2.3-platform.zip) |
| 126 | + if [[ "$name" =~ ^(.+)-([0-9]+\.[0-9]+\.[0-9]+)(-.*)?\.zip$ ]]; then |
| 127 | + prefix="${BASH_REMATCH[1]}" |
| 128 | + version="${BASH_REMATCH[2]}" |
| 129 | + suffix="${BASH_REMATCH[3]}" |
| 130 | + new_name="${prefix}-v${version}${suffix}.zip" |
| 131 | + echo "Renaming: $name -> $new_name" |
| 132 | + mv "$file" "$dir/$new_name" |
| 133 | + else |
| 134 | + echo "Filename already has v prefix or doesn't match pattern: $name" |
| 135 | + fi |
| 136 | + done |
| 137 | +
|
| 138 | + - name: Upload Windows package |
| 139 | + if: ${{ contains(inputs.platform || 'windows-zip', 'windows') }} |
| 140 | + uses: actions/upload-artifact@v4 |
| 141 | + with: |
| 142 | + name: windows-zip |
| 143 | + path: output/**/*windows*.zip |
| 144 | + retention-days: 5 |
| 145 | + |
| 146 | + - name: Upload macOS package |
| 147 | + if: ${{ contains(inputs.platform || '', 'mac') }} |
| 148 | + uses: actions/upload-artifact@v4 |
| 149 | + with: |
| 150 | + name: mac-zip-${{ inputs.arch == 'mac.aarch64' && 'aarch64' || 'amd64' }} |
| 151 | + path: output/**/*mac*.zip |
| 152 | + retention-days: 5 |
| 153 | + |
| 154 | + - name: Upload Linux package |
| 155 | + if: ${{ contains(inputs.platform || '', 'linux') }} |
| 156 | + uses: actions/upload-artifact@v4 |
| 157 | + with: |
| 158 | + name: linux-app |
| 159 | + path: output/**/*.deb |
| 160 | + retention-days: 5 |
0 commit comments