Skip to content

Merge pull request #70 from GregoryAM-SP/render-queue-count #41

Merge pull request #70 from GregoryAM-SP/render-queue-count

Merge pull request #70 from GregoryAM-SP/render-queue-count #41

Workflow file for this run

name: Build and Release Project
on:
push:
branches:
- main
env:
VERSION: 1.20.4
jobs:
build_and_release_windows:
runs-on: windows-2022
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && vars.START_BUILD == 'True'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: |
git tag ${{ env.VERSION }}
git push origin ${{ env.VERSION }}
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Fetch Pillow files
run: |
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/Imaging.h" -OutFile "Imaging.h"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/ImagingUtils.h" -OutFile "ImagingUtils.h"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/ImPlatform.h" -OutFile "ImPlatform.h"
- name: Build project for Windows
run: |
python setup.py build
pyinstaller overviewer.spec
- name: Create ZIP file for Windows
run: |
Compress-Archive -Path .\dist\overviewer -DestinationPath overviewer-${{ env.VERSION }}-windows.zip
- name: Create Release for Windows
id: create_release_windows
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: Release v${{ env.VERSION }}
body: |
Created using [The Minecraft Overviewer v1.20.4](https://github.com/GregoryAM-SP/The-Minecraft-Overviewer/releases/tag/v1.20.4)
draft: false
prerelease: false
- name: Upload Windows Release Asset
id: upload_windows_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release_windows.outputs.upload_url }}
asset_path: ./overviewer-${{ env.VERSION }}-windows.zip
asset_name: overviewer-${{ env.VERSION }}-windows.zip
asset_content_type: application/zip
outputs:
upload_url: ${{ steps.create_release_windows.outputs.upload_url }}
build_and_release_linux:
runs-on: ubuntu-22.04
needs: build_and_release_windows
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && vars.START_BUILD == 'True'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: pip install -r requirements.txt
- name: Fetch Pillow files
run: |
curl -o Imaging.h https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/Imaging.h
curl -o ImagingUtils.h https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/ImagingUtils.h
curl -o ImPlatform.h https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/ImPlatform.h
- name: Build project for Linux
run: |
python setup.py build
pyinstaller overviewer.spec
- name: Create tar.xz archive for Linux
run: |
cd dist
tar -cf overviewer-${{ env.VERSION }}-LINUX.tar overviewer
xz -z overviewer-${{ env.VERSION }}-LINUX.tar
mv overviewer-${{ env.VERSION }}-LINUX.tar.xz ../overviewer-${{ env.VERSION }}-LINUX.tar.xz
- name: Get upload URL
run: 'echo "Upload URL: ${{ needs.build_and_release_windows.outputs.upload_url }}"'
- name: Upload Linux Release Asset
id: upload_linux_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.build_and_release_windows.outputs.upload_url }}
asset_path: ./overviewer-${{ env.VERSION }}-LINUX.tar.xz
asset_name: overviewer-${{ env.VERSION }}-LINUX.tar.xz
asset_content_type: application/x-xz
build_and_release_debian:
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-20.04]
runs-on: ${{ matrix.os }}
needs: build_and_release_windows
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && vars.START_BUILD == 'True'
permissions:
id-token: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install Dependencies (apt)
run: |
sudo apt-get update -y
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install zlib1g-dev libjpeg-dev devscripts python3-all-dev debhelper python3-pil python3-numpy dh-python
- name: Install Dependencies (pip)
run: pip install -r requirements.txt
- name: Clone Pillow 10.2.0
run: git clone --branch=10.2.0 --depth=1 https://github.com/python-pillow/Pillow.git /tmp/pillow_checkout
- name: Build Extension
run: env PIL_INCLUDE_DIR=/tmp/pillow_checkout/src/libImaging/ python setup.py build
- name: Create .deb changelog
run: |
export VERSION=$(python3 setup.py --version)
export DATE=$(date -u +'%a, %d %b %Y %H:%M:%S %z')
envsubst < debian/changelog.in > debian/changelog
- name: Build .deb package
run: env DEB_BUILD_OPTIONS=nocheck debuild -i -us -uc -b -Zxz
- name: List Debian Packages
run: ls -l ../*.deb
- name: Get upload URL
run: 'echo "Upload URL: ${{ needs.build_and_release_windows.outputs.upload_url }}"'
- name: Upload Debian Package Release Asset
id: upload_debian_package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.build_and_release_windows.outputs.upload_url }}
asset_path: ../the-minecraft-overviewer_${{ env.VERSION }}-0_amd64.deb
asset_name: overviewer-v${{ env.VERSION }}-x86_64-${{ matrix.os }}.deb
asset_content_type: application/x-deb
- name: Authenticate for apt repo upload
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-1
role-to-assume: arn:aws:iam::098014529583:role/apt-repo/apt-repo-overviewer
- name: Upload package to apt repo
run: |
source /etc/os-release
sudo gem install deb-s3
deb-s3 upload \
--arch=amd64 \
--bucket=stwalkerster-098014529583-apt \
--codename=$VERSION_CODENAME \
--prefix="overviewer/" \
--visibility=private \
--preserve-versions \
../the-minecraft-overviewer_${{ env.VERSION }}-0_amd64.deb