Fix build #274
Workflow file for this run
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
name: Build | |
on: | |
push: | |
tags: | |
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
jobs: | |
createrelease: | |
name: Create Release | |
runs-on: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
name: Release ${{ github.ref_name }} | |
build-wheel: | |
name: Build wheel | |
needs: createrelease | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Build SDist and wheel | |
run: pipx run build | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/* | |
build-binary: | |
name: Build packages | |
needs: createrelease | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: windows-2019 | |
TARGET: windows | |
CMD_BUILD: | | |
python -m pip install --upgrade pip | |
pip install wheel | |
pip install -r requirements-build.txt | |
pyinstaller sticker_convert.spec | |
cd dist | |
Compress-Archive -Path sticker-convert -DestinationPath sticker-convert-windows.zip | |
OUT_FILE_NAME: ./dist/sticker-convert-windows.zip | |
- os: macos-11 | |
TARGET: macos | |
CMD_BUILD: | | |
python -m pip install --upgrade pip | |
python -m venv venv | |
source ./venv/bin/activate | |
pip install wheel delocate pyinstaller~=5.13.2 | |
pip install -r requirements-src.txt | |
mkdir wheel_arm | |
mkdir wheel_x64 | |
mkdir wheel_universal2 | |
pip download -r requirements-bin.txt --platform macosx_11_0_arm64 --only-binary=:all: -d wheel_arm | |
pip download -r requirements-bin.txt --platform macosx_11_0_x86_64 --only-binary=:all: -d wheel_x64 | |
python ./scripts/delocate-fuse-dir.py ./wheel_arm ./wheel_x64 ./wheel_universal2 | |
pip install ./wheel_universal2/*.whl | |
mkdir dist | |
cp ./scripts/run_me_first.command ./dist | |
SC_TARGET_ARCH=x86_64 pyinstaller sticker_convert.spec | |
cd dist/ | |
zip -r9 sticker-convert-macos-x86_64.zip sticker-convert.app run_me_first.command | |
rm -rf ./sticker-convert | |
rm -rf ./sticker-convert.app | |
cd ../ | |
SC_TARGET_ARCH=arm64 pyinstaller sticker_convert.spec | |
cd dist/ | |
zip -r9 sticker-convert-macos-arm64.zip sticker-convert.app run_me_first.command | |
rm -rf ./sticker-convert | |
rm -rf ./sticker-convert.app | |
cd ../ | |
SC_TARGET_ARCH=universal2 pyinstaller sticker_convert.spec | |
cd dist/ | |
zip -r9 sticker-convert-macos-universal2.zip sticker-convert.app run_me_first.command | |
OUT_FILE_NAME: | | |
./dist/sticker-convert-macos-x86_64.zip | |
./dist/sticker-convert-macos-arm64.zip | |
./dist/sticker-convert-macos-universal2.zip | |
- os: ubuntu-20.04 | |
TARGET: linux | |
CMD_BUILD: | | |
sudo apt install -y libpng-dev libxft-dev libfontconfig1-dev libfreetype6-dev | |
wget -O appimage-builder https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage | |
wget -O appimagetool https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage | |
chmod +x ./appimage-builder | |
chmod +x ./appimagetool | |
# Creating appimage directly with appimage-builder result in xz compression | |
# That would be not possible to be verified by https://appimage.github.io/apps/ | |
# Due to https://github.com/AppImage/appimage.github.io/blob/master/code/worker.sh | |
# runtime-fuse2-x86_64 unable to handle xz compression | |
./appimage-builder --skip-appimage | |
# Add .desktop comment | |
sed -i 's/Comment=/Comment=Convert (animated) stickers between WhatsApp, Telegram, Signal, Line, Kakao, iMessage/g' ./AppDir/*.desktop | |
# Add appdata.xml | |
mkdir -p AppDir/usr/share/metainfo | |
cp ./sticker-convert.appdata.xml AppDir/usr/share/metainfo | |
# Bundling into appimage | |
ARCH=x86_64 ./appimagetool ./AppDir | |
chmod +x sticker-convert-x86_64.AppImage | |
mkdir dist | |
mv ./sticker-convert-x86_64.AppImage ./dist/sticker-convert-x86_64.AppImage | |
OUT_FILE_NAME: ./dist/sticker-convert-x86_64.AppImage | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Build for ${{matrix.TARGET}} | |
run: ${{matrix.CMD_BUILD}} | |
- name: Get release | |
id: get_release | |
uses: bruceadams/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: ${{ matrix.OUT_FILE_NAME }} | |
build-docker: | |
name: Build Docker image and push | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
${{ github.repository }} | |
ghcr.io/${{ github.repository }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
upload-pypi: | |
name: Upload to pypi | |
needs: [build-wheel, build-binary] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
# unpacks default artifact into dist/ | |
# if `name: artifact` is omitted, the action will create extra parent dir | |
name: artifact | |
path: dist | |
- uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |