Skip to content

Commit 3945dae

Browse files
Update build-macos-release.yml
1 parent 87c35b5 commit 3945dae

File tree

1 file changed

+157
-136
lines changed

1 file changed

+157
-136
lines changed

.github/workflows/build-macos-release.yml

Lines changed: 157 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ jobs:
4242
run: |
4343
echo "BRANCH_NAME is $BRANCH_NAME"
4444
if [ "$BRANCH_NAME" = "main" ]; then
45-
BUCKET_NAME="github-release-files-storage"
45+
BUCKET_NAME="github-zips"
4646
else
47-
BUCKET_NAME="github-release-files-storage-beta-versions"
47+
BUCKET_NAME="github-zips-beta"
4848
fi
4949
echo "BUCKET_NAME=$BUCKET_NAME" >> $GITHUB_ENV
5050
echo "BUCKET_NAME is $BUCKET_NAME"
5151
52-
- name: Authenticate with Google Cloud
53-
uses: google-github-actions/auth@v1
54-
with:
55-
credentials_json: ${{ secrets.GOOGLE_STORAGE_UPLOAD_KEY }}
52+
# - name: Authenticate with Google Cloud
53+
# uses: google-github-actions/auth@v1
54+
# with:
55+
# credentials_json: ${{ secrets.GOOGLE_STORAGE_UPLOAD_KEY }}
5656

57-
- name: Set up Google Cloud
58-
uses: google-github-actions/setup-gcloud@v1
59-
with:
60-
project_id: github-file-storage
57+
# - name: Set up Google Cloud
58+
# uses: google-github-actions/setup-gcloud@v1
59+
# with:
60+
# project_id: github-file-storage
6161

6262
- name: Install Miniconda
6363
run: |
@@ -200,9 +200,9 @@ jobs:
200200
$conda_exe clean --all --yes
201201
cd "${root}/envs"
202202
tar -caf "env-tensorflow.tar.xz" "env-tensorflow"
203-
gsutil cp -r "env-tensorflow.tar.xz" gs://${{ env.BUCKET_NAME }}/latest/macos-latest-env-tensorflow.tar.xz
204-
rm "env-tensorflow.tar.xz"
205-
rm -r "env-tensorflow"
203+
# gsutil cp -r "env-tensorflow.tar.xz" gs://${{ env.BUCKET_NAME }}/latest/macos-latest-env-tensorflow.tar.xz
204+
# rm "env-tensorflow.tar.xz"
205+
# rm -r "env-tensorflow"
206206
cd "$HOME"
207207
208208
### install env-pytorch
@@ -220,9 +220,9 @@ jobs:
220220
$conda_exe clean --all --yes
221221
cd "${root}/envs"
222222
tar -caf "env-pytorch.tar.xz" "env-pytorch"
223-
gsutil cp -r "env-pytorch.tar.xz" gs://${{ env.BUCKET_NAME }}/latest/macos-latest-env-pytorch.tar.xz
224-
rm "env-pytorch.tar.xz"
225-
rm -r "env-pytorch"
223+
# gsutil cp -r "env-pytorch.tar.xz" gs://${{ env.BUCKET_NAME }}/latest/macos-latest-env-pytorch.tar.xz
224+
# rm "env-pytorch.tar.xz"
225+
# rm -r "env-pytorch"
226226
cd "$HOME"
227227

228228
### install env-pywildlife
@@ -236,9 +236,9 @@ jobs:
236236
$conda_exe clean --all --yes
237237
cd "${root}/envs"
238238
tar -caf "env-pywildlife.tar.xz" "env-pywildlife"
239-
gsutil cp -r "env-pywildlife.tar.xz" gs://${{ env.BUCKET_NAME }}/latest/macos-latest-env-pywildlife.tar.xz
240-
rm "env-pywildlife.tar.xz"
241-
rm -r "env-pywildlife"
239+
# gsutil cp -r "env-pywildlife.tar.xz" gs://${{ env.BUCKET_NAME }}/latest/macos-latest-env-pywildlife.tar.xz
240+
# rm "env-pywildlife.tar.xz"
241+
# rm -r "env-pywildlife"
242242
cd "$HOME"
243243

244244
### install env-speciesnet
@@ -251,9 +251,9 @@ jobs:
251251
$conda_exe clean --all --yes
252252
cd "${root}/envs"
253253
tar -caf "env-speciesnet.tar.xz" "env-speciesnet"
254-
gsutil cp -r "env-speciesnet.tar.xz" gs://${{ env.BUCKET_NAME }}/latest/macos-latest-env-speciesnet.tar.xz
255-
rm "env-speciesnet.tar.xz"
256-
rm -r "env-speciesnet"
254+
# gsutil cp -r "env-speciesnet.tar.xz" gs://${{ env.BUCKET_NAME }}/latest/macos-latest-env-speciesnet.tar.xz
255+
# rm "env-speciesnet.tar.xz"
256+
# rm -r "env-speciesnet"
257257
cd "$HOME"
258258

259259
### run pyinstaller from fresh environment
@@ -268,134 +268,155 @@ jobs:
268268
mv "${HOME}/dist/main" "${root}/AddaxAI debug" # debug executable
269269
mv "${HOME}/dist/main.app" "${root}/AddaxAI.app" # main app executable
270270

271-
- name: Zip folder contents
272-
run: |
273-
cd "$HOME"
274-
tar -caf "macos-${{ env.RELEASE_VERSION }}.tar.xz" AddaxAI_files
275-
276-
# - name: Get the release body
277-
# id: get_release
271+
272+
- name: Uploading envs Azure storage
273+
uses: LanceMcCarthy/Action-AzureBlobUpload@v2
274+
with:
275+
connection_string: ${{ secrets.AZURE_CONNECTION_STRING }}
276+
container_name: github-zips-beta
277+
source_folder: /home/runner/AddaxAI_files/envs
278+
destination_folder: ${{ env.RELEASE_VERSION }}/envs
279+
is_recursive: false
280+
delete_if_exists: true
281+
282+
- name: Uploading envs Azure storage
283+
uses: LanceMcCarthy/Action-AzureBlobUpload@v2
284+
with:
285+
connection_string: ${{ secrets.AZURE_CONNECTION_STRING }}
286+
container_name: github-zips-beta
287+
source_folder: /home/runner/AddaxAI_files/envs
288+
destination_folder: latest/envs
289+
is_recursive: false
290+
delete_if_exists: true
291+
292+
# - name: Zip folder contents
278293
# run: |
279-
# release=$(gh release view ${{ github.ref_name }} --json body -q .body)
280-
# echo "$release" > release_body.txt
294+
# cd "$HOME"
295+
# tar -caf "macos-${{ env.RELEASE_VERSION }}.tar.xz" AddaxAI_files
281296

282-
# - name: Append link to release body
283-
# id: append_link
284-
# run: |
285-
# new_body="$(cat release_body.txt)
286-
# - Install for **macOS** (Apple Silicon - M1, M2, M3, etc.): [macos-${{ env.RELEASE_VERSION }}.tar.xz](https://storage.googleapis.com/${{ env.BUCKET_NAME }}/${{ env.RELEASE_VERSION }}/macos-${{ env.RELEASE_VERSION }}.tar.xz)"
287-
# echo "$new_body" > new_release_body.txt
288-
289-
# - name: Update the release body
297+
# # - name: Get the release body
298+
# # id: get_release
299+
# # run: |
300+
# # release=$(gh release view ${{ github.ref_name }} --json body -q .body)
301+
# # echo "$release" > release_body.txt
302+
303+
# # - name: Append link to release body
304+
# # id: append_link
305+
# # run: |
306+
# # new_body="$(cat release_body.txt)
307+
# # - Install for **macOS** (Apple Silicon - M1, M2, M3, etc.): [macos-${{ env.RELEASE_VERSION }}.tar.xz](https://storage.googleapis.com/${{ env.BUCKET_NAME }}/${{ env.RELEASE_VERSION }}/macos-${{ env.RELEASE_VERSION }}.tar.xz)"
308+
# # echo "$new_body" > new_release_body.txt
309+
310+
# # - name: Update the release body
311+
# # run: |
312+
# # gh release edit ${{ github.ref_name }} --notes "$(cat new_release_body.txt)"
313+
314+
# - name: Install Platypus
290315
# run: |
291-
# gh release edit ${{ github.ref_name }} --notes "$(cat new_release_body.txt)"
292-
293-
- name: Install Platypus
294-
run: |
295-
# copy files into the right directory
296-
sudo mkdir -p '/usr/local/share/platypus/'
297-
sudo cp "${{ github.workspace }}/install_files/macos/ScriptExec" '/usr/local/share/platypus/'
298-
sudo cp "${{ github.workspace }}/install_files/macos/platypus_clt" '/usr/local/share/platypus/'
299-
sudo cp -r "${{ github.workspace }}/install_files/macos/MainMenu.nib" '/usr/local/share/platypus/'
316+
# # copy files into the right directory
317+
# sudo mkdir -p '/usr/local/share/platypus/'
318+
# sudo cp "${{ github.workspace }}/install_files/macos/ScriptExec" '/usr/local/share/platypus/'
319+
# sudo cp "${{ github.workspace }}/install_files/macos/platypus_clt" '/usr/local/share/platypus/'
320+
# sudo cp -r "${{ github.workspace }}/install_files/macos/MainMenu.nib" '/usr/local/share/platypus/'
300321

301-
# make executable
302-
sudo chmod +x '/usr/local/share/platypus/ScriptExec'
303-
sudo chmod +x '/usr/local/share/platypus/platypus_clt'
322+
# # make executable
323+
# sudo chmod +x '/usr/local/share/platypus/ScriptExec'
324+
# sudo chmod +x '/usr/local/share/platypus/platypus_clt'
304325

305-
- name: Append VERSION and URL to Platypus Installer Script
306-
shell: bash
307-
run: |
308-
# Define the file path
309-
FILE_PATH="${{ github.workspace }}/install_files/macos/platypus-install-compiler.sh"
326+
# - name: Append VERSION and URL to Platypus Installer Script
327+
# shell: bash
328+
# run: |
329+
# # Define the file path
330+
# FILE_PATH="${{ github.workspace }}/install_files/macos/platypus-install-compiler.sh"
310331

311-
# Create a new file with the VERSION line
312-
echo "VERSION=\"${{ env.RELEASE_VERSION }}\"" > newFile.sh
332+
# # Create a new file with the VERSION line
333+
# echo "VERSION=\"${{ env.RELEASE_VERSION }}\"" > newFile.sh
313334

314-
# Append the URL line
315-
echo "URL=\"https://storage.googleapis.com/${{ env.BUCKET_NAME }}/latest/macos-latest.tar.xz\"" >> newFile.sh
335+
# # Append the URL line
336+
# echo "URL=\"https://storage.googleapis.com/${{ env.BUCKET_NAME }}/latest/macos-latest.tar.xz\"" >> newFile.sh
316337

317-
# Append the original file's content
318-
cat "$FILE_PATH" >> newFile.sh
338+
# # Append the original file's content
339+
# cat "$FILE_PATH" >> newFile.sh
319340

320-
# Replace the original file with the new file
321-
mv newFile.sh "$FILE_PATH"
341+
# # Replace the original file with the new file
342+
# mv newFile.sh "$FILE_PATH"
322343

323-
- name: Create Installer
324-
run: |
325-
sudo '/usr/local/share/platypus/platypus_clt' --app-icon '${{ github.workspace }}/install_files/macos/logo.icns' --name 'AddaxAI-${{ env.RELEASE_VERSION }}-installer' --interface-type 'Progress Bar' --interpreter '/bin/bash' --app-version '${{ env.RELEASE_VERSION }}' '${{ github.workspace }}/install_files/macos/platypus-install-compiler.sh'
326-
327-
- name: Compress the macOS installer
328-
run: |
329-
cd "${{ github.workspace }}/install_files/macos"
330-
zip -r "macos-${{ env.RELEASE_VERSION }}-installer.zip" "AddaxAI-${{ env.RELEASE_VERSION }}-installer.app"
344+
# - name: Create Installer
345+
# run: |
346+
# sudo '/usr/local/share/platypus/platypus_clt' --app-icon '${{ github.workspace }}/install_files/macos/logo.icns' --name 'AddaxAI-${{ env.RELEASE_VERSION }}-installer' --interface-type 'Progress Bar' --interpreter '/bin/bash' --app-version '${{ env.RELEASE_VERSION }}' '${{ github.workspace }}/install_files/macos/platypus-install-compiler.sh'
331347

332-
- name: Get Upload URL for Release
333-
id: get_upload_url
334-
uses: actions/github-script@v6
335-
with:
336-
script: |
337-
const release = await github.rest.repos.getReleaseByTag({
338-
owner: context.repo.owner,
339-
repo: context.repo.repo,
340-
tag: '${{ env.RELEASE_VERSION }}',
341-
});
342-
// Write the upload URL to the environment file
343-
const fs = require('fs');
344-
fs.appendFileSync(process.env.GITHUB_ENV, `UPLOAD_URL=${release.data.upload_url}\n`);
345-
346-
- name: Authenticate GitHub CLI
347-
run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
348-
349-
- name: Remove existing asset if present
350-
run: |
351-
# List all assets in the release
352-
release_info=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
353-
https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ env.RELEASE_VERSION }}
354-
)
348+
# - name: Compress the macOS installer
349+
# run: |
350+
# cd "${{ github.workspace }}/install_files/macos"
351+
# zip -r "macos-${{ env.RELEASE_VERSION }}-installer.zip" "AddaxAI-${{ env.RELEASE_VERSION }}-installer.app"
352+
353+
# - name: Get Upload URL for Release
354+
# id: get_upload_url
355+
# uses: actions/github-script@v6
356+
# with:
357+
# script: |
358+
# const release = await github.rest.repos.getReleaseByTag({
359+
# owner: context.repo.owner,
360+
# repo: context.repo.repo,
361+
# tag: '${{ env.RELEASE_VERSION }}',
362+
# });
363+
# // Write the upload URL to the environment file
364+
# const fs = require('fs');
365+
# fs.appendFileSync(process.env.GITHUB_ENV, `UPLOAD_URL=${release.data.upload_url}\n`);
366+
367+
# - name: Authenticate GitHub CLI
368+
# run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
369+
370+
# - name: Remove existing asset if present
371+
# run: |
372+
# # List all assets in the release
373+
# release_info=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
374+
# https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ env.RELEASE_VERSION }}
375+
# )
355376

356-
# Extract asset ID by matching the name
357-
asset_id=$(echo $release_info | jq -r '.assets[] | select(.name == "MacOS-installer-${{ env.RELEASE_VERSION }}.zip") | .id')
358-
echo "asset_id is $asset_id"
377+
# # Extract asset ID by matching the name
378+
# asset_id=$(echo $release_info | jq -r '.assets[] | select(.name == "MacOS-installer-${{ env.RELEASE_VERSION }}.zip") | .id')
379+
# echo "asset_id is $asset_id"
359380

360-
# Check if the asset exists and delete it
361-
if [ ! -z "$asset_id" ]; then
362-
curl -X DELETE \
363-
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
364-
"https://api.github.com/repos/${{ github.repository }}/releases/assets/$asset_id"
365-
else
366-
echo "Asset not found. Continue with upload..."
367-
fi
381+
# # Check if the asset exists and delete it
382+
# if [ ! -z "$asset_id" ]; then
383+
# curl -X DELETE \
384+
# -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
385+
# "https://api.github.com/repos/${{ github.repository }}/releases/assets/$asset_id"
386+
# else
387+
# echo "Asset not found. Continue with upload..."
388+
# fi
368389

369-
- name: Upload Asset to GitHub Release
370-
uses: actions/upload-release-asset@v1
371-
with:
372-
upload_url: ${{ env.UPLOAD_URL }}
373-
asset_path: "${{ github.workspace }}/install_files/macos/macos-${{ env.RELEASE_VERSION }}-installer.zip"
374-
asset_name: "MacOS-installer-${{ env.RELEASE_VERSION }}.zip"
375-
asset_content_type: application/octet-stream
376-
env:
377-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
378-
379-
- name: Upload program files to Google Cloud
380-
run: |
381-
cd "$HOME"
390+
# - name: Upload Asset to GitHub Release
391+
# uses: actions/upload-release-asset@v1
392+
# with:
393+
# upload_url: ${{ env.UPLOAD_URL }}
394+
# asset_path: "${{ github.workspace }}/install_files/macos/macos-${{ env.RELEASE_VERSION }}-installer.zip"
395+
# asset_name: "MacOS-installer-${{ env.RELEASE_VERSION }}.zip"
396+
# asset_content_type: application/octet-stream
397+
# env:
398+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
399+
400+
# - name: Upload program files to Google Cloud
401+
# run: |
402+
# cd "$HOME"
382403

383-
# init vars
384-
BUCKET_NAME="${{ env.BUCKET_NAME }}"
385-
PINNED_FOLDER_NAME="${{ env.RELEASE_VERSION }}"
386-
LATEST_FOLDER_NAME="latest"
387-
PINNED_FILE_NAME="macos-${{ env.RELEASE_VERSION }}.tar.xz"
388-
LATEST_FILE_NAME="macos-latest.tar.xz"
389-
390-
# # upload release pinned version
391-
# # feb 2025 - disabled to save sapce on github and reduce monthly costs
392-
# gsutil cp -r $PINNED_FILE_NAME gs://$BUCKET_NAME/$PINNED_FOLDER_NAME/$PINNED_FILE_NAME
404+
# # init vars
405+
# BUCKET_NAME="${{ env.BUCKET_NAME }}"
406+
# PINNED_FOLDER_NAME="${{ env.RELEASE_VERSION }}"
407+
# LATEST_FOLDER_NAME="latest"
408+
# PINNED_FILE_NAME="macos-${{ env.RELEASE_VERSION }}.tar.xz"
409+
# LATEST_FILE_NAME="macos-latest.tar.xz"
410+
411+
# # # upload release pinned version
412+
# # # feb 2025 - disabled to save sapce on github and reduce monthly costs
413+
# # gsutil cp -r $PINNED_FILE_NAME gs://$BUCKET_NAME/$PINNED_FOLDER_NAME/$PINNED_FILE_NAME
393414

394-
# upload latest release version
395-
gsutil cp -r $PINNED_FILE_NAME gs://$BUCKET_NAME/$LATEST_FOLDER_NAME/$LATEST_FILE_NAME
415+
# # upload latest release version
416+
# gsutil cp -r $PINNED_FILE_NAME gs://$BUCKET_NAME/$LATEST_FOLDER_NAME/$LATEST_FILE_NAME
396417

397-
- name: Upload installer to Google Cloud
398-
run: |
399-
cd "${{ github.workspace }}/install_files/macos/"
400-
INSTALLER="macos-${{ env.RELEASE_VERSION }}-installer.zip"
401-
gsutil cp -r $INSTALLER gs://${{ env.BUCKET_NAME }}/latest/macos-latest-installer.zip
418+
# - name: Upload installer to Google Cloud
419+
# run: |
420+
# cd "${{ github.workspace }}/install_files/macos/"
421+
# INSTALLER="macos-${{ env.RELEASE_VERSION }}-installer.zip"
422+
# gsutil cp -r $INSTALLER gs://${{ env.BUCKET_NAME }}/latest/macos-latest-installer.zip

0 commit comments

Comments
 (0)