Skip to content

feat: Add support for multiple environment files (#225) #746

feat: Add support for multiple environment files (#225)

feat: Add support for multiple environment files (#225) #746

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
branches: [main]
tags:
- "*.*.*"
pull_request:
branches: [main]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
# Add permissions needed for creating releases
permissions:
contents: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
version: ${{ steps.get-version.outputs.version }}
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
environment-file: conda/release.yaml
channels: conda-forge,nodefaults
activate-environment: makim
auto-update-conda: true
conda-solver: libmamba
python-version: "3.11"
- name: Install deps
run: |
poetry config virtualenvs.create false
poetry install
- name: Run semantic release (for tests)
if: ${{ github.event_name != 'workflow_dispatch' }}
run: makim --verbose release.dry
- name: Run semantic release
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
poetry config pypi-token.pypi ${PYPI_TOKEN}
makim --verbose release.ci
- name: Get the current poetry version
id: get-version
run: |
poetry_version=$(poetry version --short)
echo "version=$poetry_version" >> $GITHUB_OUTPUT
echo "Project version: $poetry_version"
- name: Generate documentation with changes from semantic-release
if: ${{ github.event_name == 'workflow_dispatch' }}
run: makim --verbose docs.build
- name: GitHub Pages action
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: peaceiris/actions-gh-pages@v3.5.9
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/
- name: Setup tmate session
if: "${{ failure() && (contains(github.event.pull_request.labels.*.name, 'ci:enable-debugging')) }}"
uses: mxschmitt/action-tmate@v3
build:
needs: release
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
include:
- arch: amd64
goarch: amd64
deb_arch: amd64
rpm_arch: x86_64
- arch: arm64
goarch: arm64
deb_arch: arm64
rpm_arch: aarch64
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
environment-file: conda/release.yaml
channels: conda-forge,nodefaults
activate-environment: makim
auto-update-conda: true
conda-solver: libmamba
python-version: "3.11"
- name: Install dependencies using Poetry
run: |
poetry config virtualenvs.create false
poetry install
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"
- name: Install FPM
run: |
gem install fpm
- name: Verify FPM Installation
run: |
fpm --version || echo "Error: FPM installation failed"
- name: APT Install rpm and snap dependencies
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo apt-get install -y rpm snapd
- name: Make scripts executable
run: chmod +x packaging/scripts/postinstall.sh
- name: build python standalone binary
run: |
makim --verbose packaging.build_binary
- name: Package DEB for ${{ matrix.arch }}
run: |
makim --verbose packaging.build_deb --version ${{ needs.release.outputs.version }} --architecture ${{ matrix.arch }}
- name: Package RPM for ${{ matrix.arch }}
run: |
makim --verbose packaging.build_rpm --version ${{ needs.release.outputs.version }} --architecture ${{ matrix.arch }}
- name: Package Snap for ${{ matrix.arch }}
run: |
makim --verbose packaging.build_snap --version ${{ needs.release.outputs.version }} --architecture ${{ matrix.arch }}
- name: Upload artifacts (non-pacman)
uses: actions/upload-artifact@v4
with:
name: packages-${{ matrix.arch }}
path: |
*.deb
*.rpm
*.snap
# *.apk
build-pacman:
needs: release
runs-on: ubuntu-latest
container:
image: archlinux:latest
strategy:
matrix:
arch: [amd64, arm64]
steps:
- name: Install base dependencies
run: |
pacman -Syu --noconfirm
pacman -S --noconfirm git python python-pip python-poetry base-devel ruby ruby-erb
- name: Install FPM
run: |
gem install fpm
export GEM_HOME="${HOME}/.local/share/gem"
export PATH="${GEM_HOME}/ruby/3.4.0/bin:$PATH"
# Make sure fpm is in PATH
echo "PATH=${PATH}" >> $GITHUB_ENV
which fpm
- uses: actions/checkout@v4
- name: Set up Python venv
run: |
python -m venv /venv
source /venv/bin/activate
pip install --upgrade pip
pip install pyinstaller rapidfuzz
- name: Install dependencies using Poetry
run: |
source /venv/bin/activate
poetry config virtualenvs.create false
poetry install
- name: Make scripts executable
run: chmod +x packaging/scripts/postinstall.sh
- name: build python standalone binary
run: |
source /venv/bin/activate
makim --verbose packaging.build_binary
- name: Package pacman for ${{ matrix.arch }}
run: |
source /venv/bin/activate
makim --verbose packaging.build_pacman --version ${{ needs.release.outputs.version }} --architecture ${{ matrix.arch }}
- name: Upload pacman artifacts
uses: actions/upload-artifact@v4
with:
name: pacman-packages-${{ matrix.arch }}
path: |
*.pkg.tar.xz
package-release:
needs: [release, build, build-pacman]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all artifacts
if: needs.release.outputs.version != ''
uses: actions/download-artifact@v4
with:
path: packages
- name: Display structure of downloaded files
if: needs.release.outputs.version != ''
run: ls -R packages
- name: Flatten directory structure
if: needs.release.outputs.version != ''
run: |
mkdir -p release_files
find packages -type f -name "*.deb" -o -name "*.rpm" -o -name "*.snap" -o -name "*.pkg.tar.xz" | xargs -I {} cp {} release_files/
- name: Upload artifacts to existing release
if: needs.release.outputs.version != ''
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.release.outputs.version }}
files: release_files/*
append_body: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}