|
| 1 | +name: Build & Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + tags: |
| 8 | + - '**' |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - '**' |
| 12 | + |
| 13 | +concurrency: |
| 14 | + # SHA is added to the end if on `main` to let all main workflows run |
| 15 | + group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +env: |
| 19 | + APP_NAME: core-registry-ui |
| 20 | + |
| 21 | +jobs: |
| 22 | + build_mac: |
| 23 | + name: Build Mac Installer |
| 24 | + runs-on: macos-latest |
| 25 | + steps: |
| 26 | + - uses: Chia-Network/actions/clean-workspace@main |
| 27 | + |
| 28 | + - name: Checkout Code |
| 29 | + uses: actions/checkout@v3 |
| 30 | + |
| 31 | + - name: Setup Node 18.16 |
| 32 | + uses: actions/setup-node@v3 |
| 33 | + with: |
| 34 | + node-version: '18.16' |
| 35 | + |
| 36 | + - name: Install Husky |
| 37 | + run: npm install --save-dev husky |
| 38 | + |
| 39 | + - name: install dmg-license |
| 40 | + run: npm i dmg-license |
| 41 | + |
| 42 | + - name: npm install and build |
| 43 | + run: | |
| 44 | + npm install |
| 45 | + npm run build |
| 46 | +
|
| 47 | + - name: Import Apple installer signing certificate |
| 48 | + uses: Apple-Actions/import-codesign-certs@v1 |
| 49 | + with: |
| 50 | + p12-file-base64: ${{ secrets.APPLE_DEV_ID_APP }} |
| 51 | + p12-password: ${{ secrets.APPLE_DEV_ID_APP_PASS }} |
| 52 | + |
| 53 | + - name: Build electron app |
| 54 | + env: |
| 55 | + CSC_FOR_PULL_REQUEST: "true" |
| 56 | + run: npm run electron:package:mac |
| 57 | + |
| 58 | + - name: Notarize |
| 59 | + run: | |
| 60 | + DMG_FILE=$(find ${{ github.workspace }}/dist/ -type f -name '*.dmg') |
| 61 | + npm install -g notarize-cli |
| 62 | + notarize-cli \ |
| 63 | + --file="$DMG_FILE" \ |
| 64 | + --bundle-id net.chia.$APP_NAME \ |
| 65 | + --username "${{ secrets.APPLE_NOTARIZE_USERNAME }}" \ |
| 66 | + --password "${{ secrets.APPLE_NOTARIZE_PASSWORD }}" |
| 67 | +
|
| 68 | + - name: Upload Mac Installer |
| 69 | + uses: actions/upload-artifact@v3 |
| 70 | + with: |
| 71 | + name: $APP_NAME-mac-installer |
| 72 | + path: ${{ github.workspace }}/dist/*.dmg |
| 73 | + |
| 74 | + build_windows: |
| 75 | + name: Build Windows Installer |
| 76 | + runs-on: windows-2019 |
| 77 | + steps: |
| 78 | + - name: Checkout Code |
| 79 | + uses: actions/checkout@v3 |
| 80 | + |
| 81 | + - name: Setup Node 18.16 |
| 82 | + uses: actions/setup-node@v3 |
| 83 | + with: |
| 84 | + node-version: '18.16' |
| 85 | + |
| 86 | + - name: Install Husky |
| 87 | + run: npm install --save-dev husky |
| 88 | + |
| 89 | + - name: Ignore Husky where not compatible |
| 90 | + run: npm pkg delete scripts.prepare |
| 91 | + |
| 92 | + - name: npm install |
| 93 | + run: | |
| 94 | + node --version |
| 95 | + npm install |
| 96 | +
|
| 97 | + - name: Build electron app |
| 98 | + run: npm run electron:package:win |
| 99 | + |
| 100 | + # Windows Code Signing |
| 101 | + - name: Get installer name for signing |
| 102 | + shell: bash |
| 103 | + run: | |
| 104 | + FILE=$(find dist -type f -maxdepth 1 -name '*.exe') |
| 105 | + echo "Installer file is $FILE" |
| 106 | + echo "INSTALLER_FILE=$FILE" >> "$GITHUB_ENV" |
| 107 | +
|
| 108 | + - name: Sign windows artifacts |
| 109 | + uses: chia-network/actions/digicert/windows-sign@main |
| 110 | + with: |
| 111 | + sm_api_key: ${{ secrets.SM_API_KEY }} |
| 112 | + sm_client_cert_file_b64: ${{ secrets.SM_CLIENT_CERT_FILE_B64 }} |
| 113 | + sm_client_cert_password: ${{ secrets.SM_CLIENT_CERT_PASSWORD }} |
| 114 | + sm_code_signing_cert_sha1_hash: ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }} |
| 115 | + file: "${{ github.workspace }}/${{ env.INSTALLER_FILE }}" |
| 116 | + |
| 117 | + - name: Upload Windows Installer |
| 118 | + uses: actions/upload-artifact@v3 |
| 119 | + with: |
| 120 | + name: $APP_NAME-windows-installer |
| 121 | + path: "${{ github.workspace }}/${{ env.INSTALLER_FILE }}" |
| 122 | + |
| 123 | + build_linux: |
| 124 | + name: Build Linux Installer |
| 125 | + runs-on: ubuntu-latest |
| 126 | + steps: |
| 127 | + - name: Checkout Code |
| 128 | + uses: actions/checkout@v3 |
| 129 | + |
| 130 | + - name: Setup Node 18.16 |
| 131 | + uses: actions/setup-node@v3 |
| 132 | + with: |
| 133 | + node-version: '18.16' |
| 134 | + |
| 135 | + - name: Install Husky |
| 136 | + run: npm install --save-dev husky |
| 137 | + |
| 138 | + - name: npm install |
| 139 | + run: | |
| 140 | + node --version |
| 141 | + npm install |
| 142 | +
|
| 143 | + - name: Build electron app |
| 144 | + run: npm run electron:package:linux |
| 145 | + |
| 146 | + - name: Rename Linux installer to be standard format for apt |
| 147 | + run: | |
| 148 | + ORIGINAL=$(ls dist/*.deb) |
| 149 | + MODIFIED=${ORIGINAL:0:-10}-1${ORIGINAL#${ORIGINAL:0:-10}} |
| 150 | + mv $ORIGINAL $MODIFIED |
| 151 | +
|
| 152 | + - name: Upload Linux Installer |
| 153 | + uses: actions/upload-artifact@v3 |
| 154 | + with: |
| 155 | + name: $APP_NAME-linux-installer |
| 156 | + path: ${{ github.workspace }}/dist/*.deb |
| 157 | + |
| 158 | + build_web: |
| 159 | + name: Build CADT UI Web App |
| 160 | + runs-on: ubuntu-latest |
| 161 | + steps: |
| 162 | + - name: Checkout Code |
| 163 | + uses: actions/checkout@v3 |
| 164 | + |
| 165 | + - name: Setup Node 18.16 |
| 166 | + uses: actions/setup-node@v3 |
| 167 | + with: |
| 168 | + node-version: '18.16' |
| 169 | + |
| 170 | + - name: Install Husky |
| 171 | + run: npm install --save-dev husky |
| 172 | + |
| 173 | + - name: npm install and build |
| 174 | + run: | |
| 175 | + node --version |
| 176 | + npm install |
| 177 | + npm run build |
| 178 | +
|
| 179 | + - name: Create .tar.gz of the web build |
| 180 | + run: tar -cvzf $APP_NAME-web-build.tar.gz build |
| 181 | + |
| 182 | + - name: Upload build artifact |
| 183 | + uses: actions/upload-artifact@v3 |
| 184 | + with: |
| 185 | + name: $APP_NAME-web-build |
| 186 | + path: $APP_NAME-web-build.tar.gz |
| 187 | + |
| 188 | + release: |
| 189 | + runs-on: ubuntu-latest |
| 190 | + if: startsWith(github.ref, 'refs/tags/') |
| 191 | + needs: |
| 192 | + - build_mac |
| 193 | + - build_windows |
| 194 | + - build_linux |
| 195 | + - build_web |
| 196 | + steps: |
| 197 | + - name: Download Windows artifacts |
| 198 | + uses: actions/download-artifact@v3 |
| 199 | + with: |
| 200 | + name: $APP_NAME-windows-installer |
| 201 | + path: $APP_NAME-windows-installer |
| 202 | + |
| 203 | + - name: Download MacOS artifacts |
| 204 | + uses: actions/download-artifact@v3 |
| 205 | + with: |
| 206 | + name: $APP_NAME-mac-installer |
| 207 | + path: $APP_NAME-mac-installer |
| 208 | + |
| 209 | + - name: Download Linux artifacts |
| 210 | + uses: actions/download-artifact@v3 |
| 211 | + with: |
| 212 | + name: $APP_NAME-linux-installer |
| 213 | + path: $APP_NAME-linux-installer |
| 214 | + |
| 215 | + - name: Download Web artifact |
| 216 | + uses: actions/download-artifact@v3 |
| 217 | + with: |
| 218 | + name: $APP_NAME-web-build |
| 219 | + path: $APP_NAME-web-build |
| 220 | + |
| 221 | + - name: Get Filenames |
| 222 | + run: | |
| 223 | + DMG_FILE=$(find ${{ github.workspace }}/$APP_NAME-mac-installer/ -type f -name '*.dmg') |
| 224 | + DEB_FILE=$(find ${{ github.workspace }}/$APP_NAME-linux-installer/ -type f -name '*.deb') |
| 225 | + EXE_FILE=$(find ${{ github.workspace }}/$APP_NAME-windows-installer/ -type f -name '*.exe') |
| 226 | + WEB_FILE=$(find ${{ github.workspace }}/$APP_NAME-web-build/ -type f -name '*.tar.gz') |
| 227 | +
|
| 228 | + echo "DMG_FILE=$DMG_FILE" >>$GITHUB_ENV |
| 229 | + echo "DEB_FILE=$DEB_FILE" >>$GITHUB_ENV |
| 230 | + echo "EXE_FILE=$EXE_FILE" >>$GITHUB_ENV |
| 231 | + echo "WEB_FILE=$WEB_FILE" >>$GITHUB_ENV |
| 232 | +
|
| 233 | + - name: Release |
| 234 | + |
| 235 | + with: |
| 236 | + files: | |
| 237 | + ${{ env.DMG_FILE }} |
| 238 | + ${{ env.DEB_FILE }} |
| 239 | + ${{ env.EXE_FILE }} |
| 240 | + ${{ env.WEB_FILE }} |
| 241 | +
|
| 242 | + - name: Trigger apt repo update |
| 243 | + run: | |
| 244 | + curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"cadt_repo":"$APP_NAME","release_version":"${{ steps.tag-name.outputs.TAGNAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/cadt/${{ github.sha }}/start |
| 245 | + curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"cadt_repo":"$APP_NAME","release_version":"${{ steps.tag-name.outputs.TAGNAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/cadt/${{ github.sha }}/success/deploy |
0 commit comments