π MacOS #384
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: π MacOS | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '40 7 * * *' | |
# TODO: probably create a nightly job | |
jobs: | |
get-version: | |
name: Get version | |
runs-on: ubuntu-latest | |
outputs: | |
QGIS_VERSION: ${{ steps.get-version.outputs.QGIS_VERSION }} | |
QGIS_VERSION_SHORT: ${{ steps.get-version.outputs.QGIS_VERSION_SHORT }} | |
MICROMAMBA_PLATFORM: ${{ steps.get-version.outputs.MICROMAMBA_PLATFORM }} | |
steps: | |
- name: πΎ Get latest version | |
id: get-version | |
shell: bash | |
run: | | |
QGIS_VERSION=$(conda search -c conda-forge -f qgis | grep py311 | tail -n 1 | tr -s ' ' | cut -f 2 -d ' ') | |
QGIS_VERSION_SHORT=$(echo $QGIS_VERSION | cut -d'.' -f 1,2) | |
echo QGIS_VERSION=$QGIS_VERSION >> $GITHUB_OUTPUT | |
echo QGIS_VERSION_SHORT=$QGIS_VERSION_SHORT >> $GITHUB_OUTPUT | |
echo MICROMAMBA_PLATFORM=$MICROMAMBA_PLATFORM >> $GITHUB_OUTPUT | |
package: | |
name: Package for macOS | |
runs-on: macos-13 | |
needs: get-version | |
env: | |
QGIS_VERSION: ${{ needs.get-version.outputs.QGIS_VERSION }} | |
QGIS_VERSION_SHORT: ${{ needs.get-version.outputs.QGIS_VERSION_SHORT }} | |
MICROMAMBA_PLATFORM: ${{ needs.get-version.outputs.MICROMAMBA_PLATFORM }} | |
strategy: | |
matrix: | |
include: | |
- architecture: 'x86_64' | |
conda_platform: 'osx-64' | |
- architecture: 'arm64' | |
conda_platform: 'osx-arm64' | |
steps: | |
- name: π£ Checkout | |
uses: actions/checkout@v3 | |
- name: π£ Checkout Constructor | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
repository: opengisch/constructor | |
ref: qgis-bundling | |
path: constructor | |
- name: Prepare | |
run: | | |
sed -i '' "s/__ver__/$QGIS_VERSION/g" construct.yaml | |
sed -i '' "s/__shortver__/$QGIS_VERSION_SHORT/g" construct.yaml | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniconda-version: "latest" | |
activate-environment: "constructor" | |
environment-file: "environment.yaml" | |
- name: π¦ Package | |
shell: pwsh | |
run: | | |
curl -s https://api.github.com/repos/mamba-org/micromamba-releases/releases/latest | |
curl -s https://api.github.com/repos/mamba-org/micromamba-releases/releases/latest | grep 'browser_download_url.*micromamba-${{ matrix.conda_platform }}"' | cut -d : -f 2,3 | tr -d '"' | |
curl -s https://api.github.com/repos/mamba-org/micromamba-releases/releases/latest | grep 'browser_download_url.*micromamba-${{ matrix.conda_platform }}"' | cut -d : -f 2,3 | tr -d '"' | wget -qi - | |
wget https://github.com/mamba-org/micromamba-releases/releases/download/1.4.9-0/micromamba-${{ matrix.conda_platform }} | |
ls -al | |
conda build constructor | |
conda install /Users/runner/miniconda3/envs/constructor/conda-bld/osx-64/*.tar.bz2 | |
constructor --platform=${{ matrix.conda_platform }} --conda-exe=micromamba-${{ matrix.conda_platform }} . | |
- name: π¦ Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: QGIS-${{ env.QGIS_VERSION }}-MacOSX-${{ matrix.architecture }} | |
path: QGIS-${{ env.QGIS_VERSION }}-MacOSX-${{ matrix.architecture }}.pkg | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: | |
- get-version | |
- package | |
env: | |
QGIS_VERSION: ${{ needs.get-version.outputs.QGIS_VERSION }} | |
QGIS_VERSION_SHORT: ${{ needs.get-version.outputs.QGIS_VERSION_SHORT }} | |
MICROMAMBA_PLATFORM: ${{ needs.get-version.outputs.MICROMAMBA_PLATFORM }} | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: QGIS-${{ env.QGIS_VERSION }}-MacOSX-x86_64 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: QGIS-${{ env.QGIS_VERSION }}-MacOSX-arm64 | |
- uses: ncipollo/release-action@v1 | |
with: | |
name: ${{ env.QGIS_VERSION }} | |
artifacts: "*.pkg" | |
body: "See https://github.com/qgis/QGIS/releases" | |
tag: ${{ env.QGIS_VERSION }} | |
allowUpdates: True |