Update github workflow #44
This file contains hidden or 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
| name: Build release artefacts | ||
|
Check failure on line 1 in .github/workflows/build-release.yml
|
||
| run-name: Build release artefacts | ||
| on: | ||
| release: | ||
| types: [published] | ||
| jobs: | ||
| create-archive: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Create archive | ||
| run: | | ||
| set -x | ||
| APP_VERSION=$GITHUB_SHA | ||
| if [ "$GITHUB_REF_TYPE" = "tag" ] ; then | ||
| APP_VERSION=`echo $GITHUB_REF_NAME | cut -dv -f2-` | ||
| fi | ||
| git archive --format=tar.gz --prefix=neknihy-$APP_VERSION/ HEAD >neknihy-$APP_VERSION.tar.gz | ||
| echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_ENV" | ||
| - name: Upload tar archive | ||
| uses: actions/upload-artifact | ||
| with: | ||
| name: tar | ||
| path: neknihy-*.tar.gz | ||
| retention-days: 5 | ||
| build-rpm: | ||
| runs-on: ubuntu-latest | ||
| container: fedora:latest | ||
| needs: create-archive | ||
| steps: | ||
| - name: Download tar | ||
| uses: actions/download-artifact | ||
| with: | ||
| name: tar | ||
| - name: Install dependencies | ||
| run: | | ||
| dnf -y install rpm-build python3-devel git | ||
| - name: Build rpm | ||
| run: | | ||
| set -x | ||
| APP_VERSION=$GITHUB_SHA | ||
| if [ "$GITHUB_REF_TYPE" = "tag" ] ; then | ||
| APP_VERSION=`echo $GITHUB_REF_NAME | cut -dv -f2-` | ||
| fi | ||
| echo $APP_VERSION | ||
| rpmbuild -D "SRCVERSION $APP_VERSION" -D "_rpmdir $(pwd)/rpm" -ta neknihy-*.tar.gz | ||
| mv rpm/noarch/*.rpm ./ | ||
| - name: Upload rpm | ||
| uses: actions/upload-artifact | ||
| with: | ||
| name: rpm | ||
| path: neknihy-*.rpm | ||
| retention-days: 5 | ||
| build-windows: | ||
| runs-on: windows-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Create Executable | ||
| uses: sayyid5416/pyinstaller@v1.3.0 | ||
| with: | ||
| spec: 'src/neknihy.py' | ||
| requirements: 'src/REQUIREMENTS.txt' | ||
| options: --add-data src/resources:resources --icon src/resources/neknihy.ico -w | ||
| upload_exe_with_name: 'exe' | ||
| build-macos: | ||
| runs-on: macos-12 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Create Executable | ||
| uses: sayyid5416/pyinstaller@v1.3.0 | ||
| with: | ||
| spec: 'src/neknihy.py' | ||
| requirements: 'src/REQUIREMENTS.txt' | ||
| options: --add-data src/resources:resources --icon src/resources/neknihy.icns -w --target-architecture x86_64 | ||
| upload_exe_with_name: 'macos' | ||
| repack-zip: | ||
| runs-on: ubuntu-latest | ||
| needs: [build-windows, build-macos] | ||
| steps: | ||
| - name: Install packages | ||
| run: | | ||
| sudo apt-get install --yes zip | ||
| - name: Download exe | ||
| uses: actions/download-artifact | ||
| with: | ||
| name: exe | ||
| path: windows | ||
| - name: Download macos | ||
| uses: actions/download-artifact | ||
| with: | ||
| name: macos | ||
| path: macos | ||
| - name: Make zip | ||
| run: | | ||
| APP_VERSION=$GITHUB_SHA | ||
| if [ "$GITHUB_REF_TYPE" = "tag" ] ; then | ||
| APP_VERSION=`echo $GITHUB_REF_NAME | cut -dv -f2-` | ||
| fi | ||
| pushd windows/neknihy | ||
| zip -r ../../neknihy-win-$APP_VERSION.zip * | ||
| popd | ||
| pushd macos | ||
| zip -r ../neknihy-macos-$APP_VERSION.zip * | ||
| popd | ||
| - name: Upload win-zip archive | ||
| uses: actions/upload-artifact | ||
| with: | ||
| name: win-zip | ||
| path: neknihy-win-*.zip | ||
| retention-days: 5 | ||
| - name: Upload macos-zip archive | ||
| uses: actions/upload-artifact | ||
| with: | ||
| name: macos-zip | ||
| path: neknihy-macos-*.zip | ||
| retention-days: 5 | ||
| release-articacts: | ||
| permissions: write-all | ||
| runs-on: ubuntu-latest | ||
| needs: [create-archive, build-rpm, repack-zip] | ||
| steps: | ||
| - name: Download tar | ||
| uses: actions/download-artifact | ||
| with: | ||
| name: tar | ||
| - name: Download rpm | ||
| uses: actions/download-artifact | ||
| with: | ||
| name: rpm | ||
| - name: Download windows zip | ||
| uses: actions/download-artifact | ||
| with: | ||
| name: win-zip | ||
| - name: Download macos zip | ||
| uses: actions/download-artifact | ||
| with: | ||
| name: macos-zip | ||
| - name: Detect exact file names | ||
| run: | | ||
| echo "APP_TAR=`ls neknihy*.tar.gz`" >> "$GITHUB_ENV" | ||
| echo "APP_RPM=`ls neknihy*.rpm`" >> "$GITHUB_ENV" | ||
| echo "APP_WIN_ZIP=`ls neknihy-win*.zip`" >> "$GITHUB_ENV" | ||
| echo "APP_MACOS_ZIP=`ls neknihy-macos*.zip`" >> "$GITHUB_ENV" | ||
| - name: Upload rpm to release | ||
| uses: JasonEtco/upload-to-release@master | ||
| with: | ||
| args: ${{ env.APP_RPM }} application/octet-stream | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Upload tar to release | ||
| uses: JasonEtco/upload-to-release@master | ||
| with: | ||
| args: ${{ env.APP_TAR }} application/octet-stream | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Upload windows zip to release | ||
| uses: JasonEtco/upload-to-release@master | ||
| with: | ||
| args: ${{ env.APP_WIN_ZIP }} application/octet-stream | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Upload macos zip to release | ||
| uses: JasonEtco/upload-to-release@master | ||
| with: | ||
| args: ${{ env.APP_MACOS_ZIP }} application/octet-stream | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||