Skip to content

meetup 7/11/24

meetup 7/11/24 #29

Workflow file for this run

name: Create Release
on:
push:
branches:
- main
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11.1'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install pillow
- name: Build the project
run: |
pyinstaller --noconfirm --onedir --windowed --icon "$env:GITHUB_WORKSPACE\logo.ico" `
--paths "$env:GITHUB_WORKSPACE\gui" `
--paths "$env:GITHUB_WORKSPACE\scheduler" `
--paths "$env:GITHUB_WORKSPACE\controller" `
"manage.py"
- name: List/print files in dist folder
run: |
Get-ChildItem -Path dist -Recurse
- name: Copy additional files
run: |
Copy-Item -Path "sample.env" -Destination "dist\manage\sample.env"
Copy-Item -Path "config.yaml" -Destination "dist\manage\config.yaml"
Copy-Item -Path "logo.png" -Destination "dist\manage\logo.png"
Copy-Item -Path "database_default.sqlite3" -Destination "dist\manage\database_default.sqlite3"
- name: Zip the manage folder
run: |
cd dist
Compress-Archive -Path manage -DestinationPath manage-windows.zip
Write-Host "Current Directory: $(Get-Location)"
Get-ChildItem -Path manage-windows.zip
Move-Item -Path manage-windows.zip -Destination $env:GITHUB_WORKSPACE
Write-Host "Files in $env:GITHUB_WORKSPACE:"
Get-ChildItem -Path $env:GITHUB_WORKSPACE
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: SocialMediaScheduler-windows
path: $env:GITHUB_WORKSPACE\manage-windows.zip
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11.1'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
- name: Build the project
run: |
pyinstaller --noconfirm --onedir --windowed --icon "$(pwd)/logo.ico" \
--paths "$(pwd)/gui" \
--paths "$(pwd)/scheduler" \
--paths "$(pwd)/controller" \
"manage.py"
- name: Copy additional files
run: |
cp sample.env dist/manage/sample.env
cp config.yaml dist/manage/config.yaml
cp logo.png dist/manage/logo.png
cp database_default.sqlite3 dist/manage/database_default.sqlite3
- name: Zip the manage folder
run: |
cd dist
zip -r manage-linux.zip manage
mv manage-linux.zip $GITHUB_WORKSPACE
cd ..
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: SocialMediaScheduler-linux
path: ${{ github.workspace }}/manage-linux.zip
build-mac:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12.4'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install pillow
- name: Build the project
run: |
pyinstaller --noconfirm --onedir --windowed --icon "$(pwd)/logo.ico" \
--paths "$(pwd)/gui" \
--paths "$(pwd)/scheduler" \
--paths "$(pwd)/controller" \
"manage.py"
- name: Copy additional files
run: |
cp sample.env dist/manage/sample.env
cp config.yaml dist/manage/config.yaml
cp logo.png dist/manage/logo.png
cp database_default.sqlite3 dist/manage/database_default.sqlite3
- name: Zip the manage folder
run: |
cd dist
zip -r manage-mac.zip manage
mv manage-mac.zip $GITHUB_WORKSPACE
cd ..
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: SocialMediaScheduler-mac
path: ${{ github.workspace }}/manage-mac.zip
create_release:
needs: [build-windows, build-linux, build-mac]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download build artifacts
uses: actions/download-artifact@v2
with:
name: SocialMediaScheduler-windows
- name: Download build artifacts
uses: actions/download-artifact@v2
with:
name: SocialMediaScheduler-linux
- name: Download build artifacts
uses: actions/download-artifact@v2
with:
name: SocialMediaScheduler-mac
- name: Generate release name and tag
id: generate_release_info
run: |
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
if [[ "$COMMIT_MESSAGE" =~ ^Release.* ]]; then
TAG_NAME=$(echo "$COMMIT_MESSAGE" | awk '{print $2}')
RELEASE_NAME=$(echo "$COMMIT_MESSAGE" | awk '{$1=""; print $0}')
else
TAG_NAME="release-$(date +'%Y%m%d%H%M%S')"
RELEASE_NAME="Release $(date +'%Y-%m-%d %H:%M:%S')"
fi
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: ${{ env.RELEASE_NAME }}
draft: false
prerelease: false
- name: Upload Release Asset (Windows)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: manage-windows.zip
asset_name: SocialMediaScheduler-windows.zip
asset_content_type: application/zip
- name: Upload Release Asset (Linux)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: manage-linux.zip
asset_name: SocialMediaScheduler-linux.zip
asset_content_type: application/zip
- name: Upload Release Asset (Mac)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: manage-mac.zip
asset_name: SocialMediaScheduler-mac.zip
asset_content_type: application/zip