Fix resizing alpha images #17
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: CI/CD | |
on: | |
push: | |
branches: | |
- "master" | |
paths-ignore: | |
- "README.md" | |
- "doc/**" | |
- "map_samples/**" | |
jobs: | |
validate_release_version: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.write_output.outputs.version }} | |
tag_name: ${{ steps.write_output.outputs.tag_name }} | |
package_desc: ${{ steps.write_output.outputs.package_desc }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Determine Version | |
id: get_version | |
run: | | |
package_version=$(python ./src/version.py --version) | |
package_desc=$(python ./src/version.py --description) | |
echo "package_version=$package_version" >> $GITHUB_ENV | |
echo "tag_name=v$package_version" >> $GITHUB_ENV | |
echo "package_desc<<EOF" >> $GITHUB_ENV | |
echo "$package_desc" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- uses: mukunku/[email protected] | |
id: check_tag | |
with: | |
tag: ${{ env.tag_name }} | |
- name: Write Output | |
id: write_output | |
run: | | |
if [ ${{ steps.check_tag.outputs.exists }} = 'true' ]; then | |
echo "Tag for this release already exists! Bump version in src/version.py" | |
exit 1 | |
else | |
echo "tag_name=${{ env.tag_name }}" >> $GITHUB_OUTPUT | |
echo "version=${{ env.package_version }}" >> $GITHUB_OUTPUT | |
echo "package_desc<<EOF" >> $GITHUB_OUTPUT | |
echo "${{ env.package_desc }}" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
fi | |
build_linux: | |
runs-on: ubuntu-latest | |
needs: validate_release_version | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
sudo apt-get install qtbase5-dev qt5-qmake | |
pip install -r src/requirements.txt | |
- name: Install build dependencies | |
run: pip install -r build/requirements-dev.txt | |
- name: Make staging directory for build | |
run: mkdir stage | |
- name: Package tools for Linux | |
run: cp -r tools/linux stage/tools | |
- name: Package support files | |
run: | | |
cp -r resources stage | |
cp LICENSE stage | |
cp README.md stage | |
- name: Package build | |
run: | | |
cd build/linux | |
sh build.sh | |
cd ../.. | |
cp -r bin/pymapconv stage | |
tar -czvf "pymapconv.v${{ needs.validate_release_version.outputs.version }}.linux-amd64.tar.gz" -C stage . | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: linux-build | |
path: pymapconv.v${{ needs.validate_release_version.outputs.version }}.linux-amd64.tar.gz | |
build_windows: | |
runs-on: windows-latest | |
needs: validate_release_version | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
pip install -r src/requirements.txt | |
- name: Install build dependencies | |
run: | | |
pip install -r build/requirements-dev.txt | |
- name: Make staging directory for build | |
run: mkdir stage | |
- name: Package tools for Windows | |
run: cp -r tools/win stage/tools | |
- name: Package support files | |
run: | | |
cp -r resources stage | |
cp LICENSE stage | |
cp README.md stage | |
cp build/win/nvdxt.exe stage | |
- name: Package build | |
run: | | |
cd ./build/win | |
powershell ./build.ps1 | |
cd ../.. | |
cp -r bin/pymapconv.exe stage | |
Compress-Archive -Path stage/* -DestinationPath pymapconv.v${{ needs.validate_release_version.outputs.version }}.windows-amd64.zip | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: windows-build | |
path: pymapconv.v${{ needs.validate_release_version.outputs.version }}.windows-amd64.zip | |
release: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
permissions: | |
contents: write | |
needs: | |
- build_linux | |
- build_windows | |
- validate_release_version | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download Linux Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux-build | |
- name: Download Windows Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: windows-build | |
- name: Create Release Tag | |
uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: ${{ needs.validate_release_version.outputs.tag_name }} | |
tag_exists_error: true | |
message: Release ${{ needs.validate_release_version.outputs.tag_name }} | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: v${{ needs.validate_release_version.outputs.version }} | |
tag_name: ${{ needs.validate_release_version.outputs.tag_name }} | |
prerelease: false | |
body: ${{ needs.validate_release_version.outputs.package_desc }} | |
files: | | |
pymapconv.v${{ needs.validate_release_version.outputs.version }}.linux-amd64.tar.gz | |
pymapconv.v${{ needs.validate_release_version.outputs.version }}.windows-amd64.zip |