Bump actions/cache from 4.1.2 to 4.2.0 (#150) #194
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: "📦 Packager" | |
env: | |
PROJECT_FOLDER: "RoofClassify" | |
PYTHON_VERSION: 3.9 | |
on: | |
push: | |
branches: [master] | |
tags: "*" | |
pull_request: | |
branches: [master] | |
paths: | |
- .github/workflows/packager.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" | |
- uses: actions/[email protected] | |
with: | |
path: ~\AppData\Local\pip\Cache | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- 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 }}/embedded_external_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 }}/embedded_external_libs -type d -name tests` | |
rm -rf `find ${{ env.PROJECT_FOLDER }}/embedded_external_libs -type d -name test` | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dependencies-build | |
path: ${{ env.PROJECT_FOLDER }}/embedded_external_libs/ | |
if-no-files-found: error | |
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" | |
- uses: actions/[email protected] | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- 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 }}/embedded_external_libs/ | |
# - name: List plugin files - only for debugging | |
# run: ls -R ${{ env.PROJECT_FOLDER }}/ | |
- name: Amend gitignore to include embedded libs with qgis-plugin-ci | |
run: | | |
sed -i 's/^\*\.py\[cod\].*//' .gitignore | |
sed -i "s|^${{ env.PROJECT_FOLDER }}/embedded_external_libs/.*| |" .gitignore | |
git add ${{ env.PROJECT_FOLDER }}/embedded_external_libs/ | |
- name: Package the latest version | |
run: qgis-plugin-ci package latest --allow-uncommitted-changes | |
# - name: Insert dependencies into created zip | |
# run: zip -r9 `find . -type f -name *.zip` ${{ env.PROJECT_FOLDER }}/embedded_external_libs/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PROJECT_FOLDER }}-latest | |
path: ${{ env.PROJECT_FOLDER }}.*.zip | |
if-no-files-found: error | |
# -- ONLY ON TAGS ---------------------------------------------------------------------- | |
release: | |
name: "🚀 Release on tag" | |
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" | |
- uses: actions/[email protected] | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- 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 }}/embedded_external_libs/ | |
- name: Amend gitignore to include embedded libs with qgis-plugin-ci | |
run: | | |
sed -i 's/^\*\.py\[cod\].*//' .gitignore | |
sed -i "s|^${{ env.PROJECT_FOLDER }}/embedded_external_libs/.*| |" .gitignore | |
git add ${{ env.PROJECT_FOLDER }}/embedded_external_libs/ | |
- 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\//} | |
--github-token ${{ secrets.GITHUB_TOKEN }} | |
--create-plugin-repo | |
--allow-uncommitted-changes | |
--osgeo-username ${{ secrets.OSGEO_USER }} | |
--osgeo-password ${{ secrets.OSGEO_PASSWORD }} |