Skip to content

Commit

Permalink
Merge pull request #24 from plammens/ci/preserve-executable-permission
Browse files Browse the repository at this point in the history
ci: Better packaging of executable for Linux and macOS
  • Loading branch information
plammens authored Jun 12, 2022
2 parents 2c3a48c + cbc8611 commit 000e1fa
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ jobs:
SEP=$(python -c "import os; print(os.pathsep)")
pyinstaller --onefile -p src -n loveletter_cli src/loveletter_cli/__main__.py --add-data __version__.txt$SEP.
ARTIFACT_PATH_ORIGINAL=$(find dist -type f -name "loveletter_cli*")
ARTIFACT_PATH=${ARTIFACT_NAME}.exe
ARTIFACT_PATH=$(echo $ARTIFACT_NAME | sed 's/\./_/g') # escape dots as underscores
if [[ ${{ runner.os }} == 'Windows' ]]; then
ARTIFACT_PATH=$ARTIFACT_PATH.exe
fi
mv $ARTIFACT_PATH_ORIGINAL $ARTIFACT_PATH
echo "ARTIFACT_PATH=$ARTIFACT_PATH" >> $GITHUB_ENV
shell: bash
Expand All @@ -120,6 +123,16 @@ jobs:
run: ./$ARTIFACT_PATH --version
shell: bash

- name: Put executable in a tarball
if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }}
run: |
TAR_PATH=$ARTIFACT_PATH.tar
chmod +x $ARTIFACT_PATH
tar -cvf $TAR_PATH $ARTIFACT_PATH
ARTIFACT_PATH=$TAR_PATH
echo "ARTIFACT_PATH=$ARTIFACT_PATH" >> $GITHUB_ENV
shell: bash

- name: Upload artifact to workflow
uses: actions/upload-artifact@v3
with:
Expand Down

0 comments on commit 000e1fa

Please sign in to comment.