Bump actions/download-artifact from 3 to 4 (#38) #67
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: "📦 Packaging & 🚀 Release" | |
env: | |
PROJECT_FOLDER: "pyqgis_resource_browser" | |
PYTHON_VERSION: 3.9 | |
on: | |
push: | |
branches: [main] | |
tags: | |
- "*" | |
pull_request: | |
branches: [main] | |
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@v3 | |
with: | |
name: translations-build | |
path: ${{ env.PROJECT_FOLDER }}/**/*.qm | |
if-no-files-found: error | |
# -- NO TAGS ---------------------------------------------------------------------- | |
packaging: | |
name: "📦 Packaging plugin" | |
runs-on: ubuntu-latest | |
needs: [translation] | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
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: List files | |
run: tree ${{ env.PROJECT_FOLDER }} | |
- name: Amend gitignore to include compiled translations and add it to tracked files | |
run: | | |
# include compiled translations | |
sed -i "s|^*.qm.*| |" .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@v3 | |
with: | |
name: ${{ env.PROJECT_FOLDER }}-latest | |
path: ${{ env.PROJECT_FOLDER }}.*.zip | |
if-no-files-found: error | |
# -- ONLY TAGS ---------------------------------------------------------------------- | |
release: | |
name: "🚀 Release on tag" | |
runs-on: ubuntu-latest | |
needs: [translation] | |
permissions: | |
contents: write | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
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: Amend gitignore to include compiled translations and add it to tracked files | |
run: | | |
# include compiled translations | |
sed -i "s|^*.qm.*| |" .gitignore | |
# git add full project | |
git add ${{ env.PROJECT_FOLDER }}/ | |
- name: Get current changelog | |
run: qgis-plugin-ci changelog ${GITHUB_REF/refs\/tags\//} >> release.md | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
fail_on_unmatched_files: true | |
body_path: release.md | |
generate_release_notes: true | |
- 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 }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.PROJECT_FOLDER }}-${GITHUB_REF/refs\/tags\//} | |
path: ${{ env.PROJECT_FOLDER }}.*.zip | |
if-no-files-found: error |