Merge pull request #329 from QGIS-Contribution/pre-commit-ci-update-c⦠#90
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 & π Release" | |
env: | |
PROJECT_FOLDER: "qgis_resource_sharing" | |
PYTHON_VERSION: 3.9 | |
on: | |
push: | |
branches: [master] | |
tags: | |
- "*" | |
pull_request: | |
branches: [master] | |
paths: | |
- .github/workflows/build_release.yml | |
jobs: | |
translation: | |
name: "π¬ i18n compilation" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get source code | |
uses: actions/checkout@v4 | |
- name: Install system requirements | |
run: | | |
sudo apt update | |
sudo apt install qt5-qmake qttools5-dev-tools | |
- name: Update translations | |
run: lupdate -noobsolete -verbose ${{ env.PROJECT_FOLDER }}/resources/i18n/plugin_translation.pro | |
- name: Compile translations | |
run: lrelease ${{ env.PROJECT_FOLDER }}/resources/i18n/*.ts | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: translations-build | |
path: ${{ env.PROJECT_FOLDER }}/**/*.qm | |
if-no-files-found: error | |
dependencies: | |
name: "𧱠Dependencies build" | |
runs-on: windows-latest | |
steps: | |
- name: Get source code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: "pip" | |
cache-dependency-path: "requirements/embedded.txt" | |
- name: Install project requirements | |
run: | | |
python -m pip install -U pip setuptools wheel | |
python -m pip install --no-deps -U -r requirements/embedded.txt -t ${{ env.PROJECT_FOLDER }}/ext_libs | |
- name: Cleaning up | |
shell: bash | |
run: | | |
rm -rf `find ${{ env.PROJECT_FOLDER }} -type d -name __pycache__` | |
rm -rf `find ${{ env.PROJECT_FOLDER }} -type d -name *.dist-info` | |
rm -rf `find ${{ env.PROJECT_FOLDER }}/ext_libs -type d -name docs` | |
rm -rf `find ${{ env.PROJECT_FOLDER }}/ext_libs -type d -name tests` | |
rm -rf `find ${{ env.PROJECT_FOLDER }}/ext_libs -type d -name test` | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dependencies-build | |
path: ${{ env.PROJECT_FOLDER }}/ext_libs/ | |
if-no-files-found: error | |
# -- NO TAGS ---------------------------------------------------------------------- | |
packaging: | |
name: "π¦ Packaging plugin" | |
runs-on: ubuntu-latest | |
needs: [translation, dependencies] | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: "pip" | |
cache-dependency-path: "requirements/packaging.txt" | |
- name: Install project requirements | |
run: | | |
python -m pip install -U pip setuptools wheel | |
python -m pip install -U -r requirements/packaging.txt | |
- name: Download translations | |
uses: actions/download-artifact@v4 | |
with: | |
name: translations-build | |
path: ${{ env.PROJECT_FOLDER }} | |
- name: Download dependencies | |
uses: actions/download-artifact@v4 | |
with: | |
name: dependencies-build | |
path: ${{ env.PROJECT_FOLDER }}/ext_libs/ | |
- name: List files | |
run: tree ${{ env.PROJECT_FOLDER }} | |
- name: Amend gitignore to include compiled translations and add it to tracked files | |
run: | | |
# include compiled translations and dependencies | |
sed -i "s|^*.qm.*| |" .gitignore | |
sed -i "s|^${{ env.PROJECT_FOLDER }}/ext_libs/.*| |" .gitignore | |
# git add full project | |
git add ${{ env.PROJECT_FOLDER }}/ | |
- name: Package the latest version | |
run: qgis-plugin-ci package latest --allow-uncommitted-changes | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PROJECT_FOLDER }}-latest | |
path: ${{ env.PROJECT_FOLDER }}.*.zip | |
if-no-files-found: error | |
# -- ONLY TAGS ---------------------------------------------------------------------- | |
release: | |
name: "π Release" | |
runs-on: ubuntu-latest | |
needs: [translation, dependencies] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Get tag name as version | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: "pip" | |
cache-dependency-path: "requirements/packaging.txt" | |
- name: Install project requirements | |
run: | | |
python -m pip install -U pip setuptools wheel | |
python -m pip install -U -r requirements/packaging.txt | |
- name: Download translations | |
uses: actions/download-artifact@v4 | |
with: | |
name: translations-build | |
path: ${{ env.PROJECT_FOLDER }} | |
- name: Download dependencies | |
uses: actions/download-artifact@v4 | |
with: | |
name: dependencies-build | |
path: ${{ env.PROJECT_FOLDER }}/ext_libs/ | |
- name: Amend gitignore to include compiled translations and add it to tracked files | |
run: | | |
# include compiled translations and dependencies | |
sed -i "s|^*.qm.*| |" .gitignore | |
sed -i "s|^${{ env.PROJECT_FOLDER }}/ext_libs/.*| |" .gitignore | |
# git add full project | |
git add ${{ env.PROJECT_FOLDER }}/ | |
- name: Get current changelog for ${VERSION} | |
run: qgis-plugin-ci changelog ${GITHUB_REF/refs\/tags\//} >> release.md | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
body_path: release.md | |
- name: Deploy plugin | |
run: >- | |
qgis-plugin-ci | |
release ${GITHUB_REF/refs\/tags\//} | |
--allow-uncommitted-changes | |
--create-plugin-repo | |
--github-token ${{ secrets.GITHUB_TOKEN }} | |
--osgeo-username ${{ secrets.OSGEO_USER }} | |
--osgeo-password ${{ secrets.OSGEO_PASSWORD }} |