Skip to content

Commit

Permalink
fix macos file's extension for release artifacts (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
KTrain5169 authored Dec 3, 2024
1 parent 50a2cb0 commit c961620
Showing 1 changed file with 34 additions and 63 deletions.
97 changes: 34 additions & 63 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,50 @@ jobs:
pip install pyinstaller
- name: PyInstaller (Terminal GUI)
run: pyinstaller --onefile --icon=images/icon.ico versions/terminal_gui.py --name ${{ matrix.os }}_${{ github.ref_name }}_cmd-release
run: pyinstaller --onefile --icon=images/icon.ico versions/terminal_gui.py --name translator_cmd_${{ matrix.os }}

- name: List dist directory # debug
run: ls -R dist

- name: PyInstaller (CLI)
run: pyinstaller --onefile --icon=images/icon.ico versions/cli_args.py --name ${{ matrix.os }}_${{ github.ref_name }}_cli-release
run: pyinstaller --onefile --icon=images/icon.ico versions/cli_args.py --name translator_cli_${{ matrix.os }}

- name: List dist directory
run: ls -R dist

- name: Tar files on Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
chmod +x dist/${{ matrix.os }}_${{ github.ref_name }}_cmd-release
chmod +x dist/${{ matrix.os }}_${{ github.ref_name }}_cli-release
tar -czvf dist/${{ matrix.os }}_${{ github.ref_name }}_cmd.tar.gz dist/${{ matrix.os }}_${{ github.ref_name }}_cmd-release
tar -czvf dist/${{ matrix.os }}_${{ github.ref_name }}_cli.tar.gz dist/${{ matrix.os }}_${{ github.ref_name }}_cli-release
rm -rf dist/${{ matrix.os }}_${{ github.ref_name }}_cmd-release
rm -rf dist/${{ matrix.os }}_${{ github.ref_name }}_cli-release
chmod +x dist/${{ matrix.os }}_cmd-release
chmod +x dist/${{ matrix.os }}_cli-release
tar -czvf dist/translator@${{ github.ref_name }}_${{ matrix.os }}_cmd.tar.gz dist/${{ matrix.os }}_cmd-release
tar -czvf dist/translator@${{ github.ref_name }}_${{ matrix.os }}_cli.tar.gz dist/${{ matrix.os }}_cli-release
rm -rf dist/${{ matrix.os }}_cmd-release
rm -rf dist/${{ matrix.os }}_cli-release
- name: Zip folder on Mac
if: ${{ matrix.os == 'macos-latest' }}
run: |
zip -r translator@${{ github.ref_name }}_${{ matrix.os }}.zip dist/
rm -rf dist/
mkdir dist/
mv translator@${{ github.ref_name }}_${{ matrix.os }}.zip dist/
- name: Zip folder on Windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
$itemsToZip = @(".\dist\${{ matrix.os }}_cmd-release", ".\dist\${{ matrix.os }}_cli-release")
Compress-Archive -Path $itemsToZip -DestinationPath ".\dist\translator@${{ github.ref_name }}_${{ matrix.os }}.zip"
if (Test-Path ".\dist\translator@${{ github.ref_name }}_${{ matrix.os }}.zip") {
foreach ($item in $itemsToZip) {
Remove-Item -Path $item -Recurse -Force
}
Write-Output "Files zipped and originals deleted successfully."
exit 0
} else {
Write-Output "Failed to create zip file. Source files were not deleted."
exit 1
}
- name: Upload debug builds
uses: actions/upload-artifact@v4
Expand All @@ -69,7 +93,6 @@ jobs:
name: Draft normal release
runs-on: ubuntu-latest
needs: build
if: ${{ !contains(github.ref_name, '_') }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
Expand All @@ -86,59 +109,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
tag: ${{ github.ref_name }}
artifacts: release-artifacts/*_dists/*_${{ github.ref_name }}_*
artifacts: release-artifacts/*_dists/translator@*
draft: true
name: "Release ${{ github.ref_name }}"
body: "If you're using the CLI, we recommend renaming the artifact to something shorter, like 'translator-CLI'."

release_cmdgui:
name: Draft CMDGUI release
runs-on: ubuntu-latest
needs: build
if: ${{ endsWith(github.ref_name, '_CMDGUI') }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
pattern: "*_dists"

- name: List release-artifacts directory # debug
run: ls -R release-artifacts

- name: Draft CMDGUI release
uses: ncipollo/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
tag: ${{ github.ref_name }}
artifacts: release-artifacts/*_dists/*_${{ github.ref_name }}_cmd*
draft: true
name: "CMDGUI Release ${{ github.ref_name }}"
body: "This is a CMDGUI-specific release."

release_cli:
name: Draft CLI release
runs-on: ubuntu-latest
needs: build
if: ${{ endsWith(github.ref_name, '_CLI') }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
pattern: "*_dists"

- name: List release-artifacts directory # debug
run: ls -R release-artifacts

- name: Draft CLI release
uses: ncipollo/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
tag: ${{ github.ref_name }}
artifacts: release-artifacts/*_dists/*_${{ github.ref_name }}_cli*
draft: true
name: "CLI Release ${{ github.ref_name }}"
body: "This is a CLI-specific release. We recommend renaming the artifact to something shorter, like 'translator-CLI'."
body: "If you're using the CLI, we recommend renaming the artifact to something shorter, like 'translator-CLI'."

0 comments on commit c961620

Please sign in to comment.