-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* GH action deploy workflow
- Loading branch information
Showing
3 changed files
with
266 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build_macos_arm64: | ||
runs-on: macos-14 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Extract version tag | ||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- run: pip install -r requirements.txt | ||
|
||
- name: Install Certificate | ||
run: | | ||
echo "${{ secrets.CERTIFICATE_BASE64 }}" | base64 --decode -o certificate.p12 | ||
security create-keychain -p "temp_password" build.keychain | ||
security default-keychain -s build.keychain | ||
security unlock-keychain -p "temp_password" build.keychain | ||
security import certificate.p12 -k build.keychain -P ${{ secrets.CERTIFICATE_PASSWORD }} -T /usr/bin/codesign | ||
security set-key-partition-list -S apple-tool:,apple: -s -k "temp_password" build.keychain | ||
- name: Decode API Key | ||
run: | | ||
echo "${{ secrets.API_KEY }}" | base64 --decode -o ./AuthKey.p8 | ||
- name: Prepare Notary | ||
run: | | ||
xcrun notarytool store-credentials "GitHubActions" --key ./AuthKey.p8 --key-id ${{ secrets.API_KEY_ID }} --issuer ${{ secrets.ISSUER_ID }} | ||
- name: Prepare .spec File | ||
run: | | ||
sed -i '' "s/SECRET_DEVELOPER_ID/${{ secrets.DEVELOPER_ID }}/" SmartImageShrink.spec | ||
sed -i '' "s/SmartImageShrink_TAGVERSION/SmartImageShrink_${{ env.VERSION }}/" SmartImageShrink.spec | ||
sed -i '' "s/OS_ARCHITECTURE/arm64/" SmartImageShrink.spec | ||
- name: Bundle APP | ||
run: pyinstaller SmartImageShrink.spec | ||
|
||
- name: Set Executable Permissions | ||
run: chmod +x dist/SmartImageShrink_${{ env.VERSION }}.app/Contents/MacOS/SmartImageShrink_${{ env.VERSION }} | ||
|
||
- name: Zip the App for Notarization | ||
run: | | ||
zip -r -y -p SmartImageShrink_${{ env.VERSION }}.app.zip dist/SmartImageShrink_${{ env.VERSION }}.app | ||
- name: Notarize | ||
run: | | ||
xcrun notarytool submit SmartImageShrink_${{ env.VERSION }}.app.zip --keychain-profile "GitHubActions" --wait | ||
- name: Staple the App | ||
run: xcrun stapler staple dist/SmartImageShrink_${{ env.VERSION }}.app | ||
|
||
- name: check | ||
run: spctl -a -t exec -vv dist/SmartImageShrink_${{ env.VERSION }}.app | ||
|
||
- name: Prepare Tar Directory with name of the app | ||
run: | | ||
mkdir -p SmartImageShrink_${{ env.VERSION }}_macOS_arm64 | ||
cp -R dist/SmartImageShrink_${{ env.VERSION }}.app SmartImageShrink_${{ env.VERSION }}_macOS_arm64/ | ||
- name: Check permissions | ||
run: ls -l SmartImageShrink_${{ env.VERSION }}_macOS_arm64/SmartImageShrink_${{ env.VERSION }}.app/Contents/MacOS/* | ||
|
||
- name: Tar the application to preserve permissions | ||
run: tar -cvf SmartImageShrink_${{ env.VERSION }}_macOS_arm64.app.tar SmartImageShrink_${{ env.VERSION }}_macOS_arm64 | ||
|
||
- name: Upload Tarred App as Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: SmartImageShrink_${{ env.VERSION }}_macOS_arm64 | ||
path: SmartImageShrink_${{ env.VERSION }}_macOS_arm64.app.tar | ||
|
||
build_macos_x86_64x: | ||
runs-on: macos-13 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Extract version tag | ||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- run: pip install -r requirements.txt | ||
|
||
- name: Install Certificate | ||
run: | | ||
echo "${{ secrets.CERTIFICATE_BASE64 }}" | base64 --decode -o certificate.p12 | ||
security create-keychain -p "temp_password" build.keychain | ||
security default-keychain -s build.keychain | ||
security unlock-keychain -p "temp_password" build.keychain | ||
security import certificate.p12 -k build.keychain -P ${{ secrets.CERTIFICATE_PASSWORD }} -T /usr/bin/codesign | ||
security set-key-partition-list -S apple-tool:,apple: -s -k "temp_password" build.keychain | ||
- name: Decode API Key | ||
run: | | ||
echo "${{ secrets.API_KEY }}" | base64 --decode -o ./AuthKey.p8 | ||
- name: Prepare Notary | ||
run: | | ||
xcrun notarytool store-credentials "GitHubActions" --key ./AuthKey.p8 --key-id ${{ secrets.API_KEY_ID }} --issuer ${{ secrets.ISSUER_ID }} | ||
- name: Prepare .spec File | ||
run: | | ||
sed -i '' "s/SECRET_DEVELOPER_ID/${{ secrets.DEVELOPER_ID }}/" SmartImageShrink.spec | ||
sed -i '' "s/SmartImageShrink_TAGVERSION/SmartImageShrink_${{ env.VERSION }}/" SmartImageShrink.spec | ||
sed -i '' "s/OS_ARCHITECTURE/x86_64/" SmartImageShrink.spec | ||
- name: Bundle APP | ||
run: pyinstaller SmartImageShrink.spec | ||
|
||
- name: Set Executable Permissions | ||
run: chmod +x dist/SmartImageShrink_${{ env.VERSION }}.app/Contents/MacOS/SmartImageShrink_${{ env.VERSION }} | ||
|
||
- name: Zip the App for Notarization | ||
run: | | ||
zip -r -y -p SmartImageShrink_${{ env.VERSION }}.app.zip dist/SmartImageShrink_${{ env.VERSION }}.app | ||
- name: Notarize | ||
run: | | ||
xcrun notarytool submit SmartImageShrink_${{ env.VERSION }}.app.zip --keychain-profile "GitHubActions" --wait | ||
- name: Staple the App | ||
run: xcrun stapler staple dist/SmartImageShrink_${{ env.VERSION }}.app | ||
|
||
- name: check | ||
run: spctl -a -t exec -vv dist/SmartImageShrink_${{ env.VERSION }}.app | ||
|
||
- name: Prepare Tar Directory with name of the app | ||
run: | | ||
mkdir -p SmartImageShrink_${{ env.VERSION }}_macOS_x86_64 | ||
cp -R dist/SmartImageShrink_${{ env.VERSION }}.app SmartImageShrink_${{ env.VERSION }}_macOS_x86_64/ | ||
- name: Check permissions | ||
run: ls -l SmartImageShrink_${{ env.VERSION }}_macOS_x86_64/SmartImageShrink_${{ env.VERSION }}.app/Contents/MacOS/* | ||
|
||
- name: Tar the application to preserve permissions | ||
run: tar -cvf SmartImageShrink_${{ env.VERSION }}_macOS_intel_x86_64.app.tar SmartImageShrink_${{ env.VERSION }}_macOS_x86_64 | ||
|
||
- name: Upload Tarred App as Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: SmartImageShrink_${{ env.VERSION }}_macOS_intel_x86_64 | ||
path: SmartImageShrink_${{ env.VERSION }}_macOS_intel_x86_64.app.tar | ||
|
||
build_windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Extract version tag | ||
run: | | ||
$tagVersion = "${{ github.ref }}".Split('/')[-1] | ||
echo "VERSION=$tagVersion" | Out-File -FilePath $env:GITHUB_ENV -Append | ||
shell: pwsh | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- run: pip install -r requirements.txt | ||
|
||
- name: Prepare .spec File | ||
shell: pwsh | ||
run: | | ||
(Get-Content SmartImageShrink.spec) -replace 'SECRET_DEVELOPER_ID', '' -replace 'SmartImageShrink_TAGVERSION', 'SmartImageShrink_${{ env.VERSION }}' -replace 'OS_ARCHITECTURE', 'x86_64' -replace 'img/icon.png', 'img\\icon.ico' | Set-Content SmartImageShrink.spec | ||
- name: Bundle APP | ||
run: pyinstaller SmartImageShrink.spec | ||
|
||
- name: Prepare Directory with name of the app | ||
run: | | ||
New-Item -ItemType Directory -Path SmartImageShrink_${{ env.VERSION }}_win | ||
Move-Item dist\SmartImageShrink_${{ env.VERSION }}.exe SmartImageShrink_${{ env.VERSION }}_win\SmartImageShrink_${{ env.VERSION }}.exe | ||
shell: pwsh | ||
|
||
- name: Zip the application to preserve permissions | ||
shell: pwsh | ||
run: Compress-Archive -Path SmartImageShrink_${{ env.VERSION }}_win -DestinationPath SmartImageShrink_${{ env.VERSION }}_win.zip | ||
|
||
- name: Upload App as Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: SmartImageShrink_${{ env.VERSION }}_win | ||
path: SmartImageShrink_${{ env.VERSION }}_win.zip | ||
|
||
release: | ||
needs: [build_macos_arm64, build_macos_x86_64x, build_windows] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Extract version tag | ||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
|
||
- name: Download All Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: artifacts/ | ||
merge-multiple: true | ||
|
||
- name: List downloaded artifacts | ||
run: ls -R artifacts/ | ||
|
||
- name: Create and Upload Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: ${{ env.VERSION }} | ||
name: Release ${{ env.VERSION }} | ||
files: artifacts/* | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
|
||
|
||
a = Analysis( | ||
['main.py'], | ||
pathex=[], | ||
binaries=[], | ||
datas=[('img', 'img')], | ||
hiddenimports=[], | ||
hookspath=[], | ||
hooksconfig={}, | ||
runtime_hooks=[], | ||
excludes=[], | ||
noarchive=False, | ||
optimize=0, | ||
) | ||
pyz = PYZ(a.pure) | ||
|
||
exe = EXE( | ||
pyz, | ||
a.scripts, | ||
a.binaries, | ||
a.datas, | ||
[], | ||
name='SmartImageShrink_TAGVERSION', | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=False, | ||
upx_exclude=[], | ||
runtime_tmpdir=None, | ||
console=False, | ||
disable_windowed_traceback=False, | ||
argv_emulation=False, | ||
target_arch='OS_ARCHITECTURE', | ||
codesign_identity='SECRET_DEVELOPER_ID', | ||
entitlements_file=None, | ||
icon=['img/icon.png'], | ||
) | ||
app = BUNDLE( | ||
exe, | ||
name='SmartImageShrink_TAGVERSION.app', | ||
icon='img/icon.png', | ||
bundle_identifier='com.presa.SmartImageShrink', | ||
) |