Skip to content

Commit

Permalink
Update build action (#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcauliffe authored Mar 18, 2023
1 parent e56da4e commit 09fc6ae
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 52 deletions.
63 changes: 13 additions & 50 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,28 @@
name: Publish Python distributions to PyPI and TestPyPI
name: Publish Python distributions to PyPI

on:
- push
- release

env:
CACHE_NUMBER: 0 # increase to reset cache manually
release:
types: [published]

jobs:
build-n-publish:
name: Build and publish to PyPI and TestPyPI
name: Build and publish to PyPI
runs-on: ubuntu-latest
defaults:
run:
# Adding -l {0} helps ensure conda can be found properly.
shell: bash -l {0}
env:
ENV_NAME: mfa_publish
PYTHON: 3.8
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0

- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: my-env
use-mamba: true
- name: Set cache date
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV

- uses: actions/cache@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
path: /usr/share/miniconda3/envs/my-env
key: linux-64-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache

- name: Update environment
run: mamba env update -n my-env -f environment.yml
if: steps.cache.outputs.cache-hit != 'true'

- name: Create environment variable
if: startsWith(github.ref, 'refs/tags/') != true
run: |
wget https://gist.github.com/plaplant/0902f09e59166bac742bbd554f3cd2f9/raw/make_dev_version.sh
version=$(bash make_dev_version.sh)
echo "SETUPTOOLS_SCM_PRETEND_VERSION=$version" >> $GITHUB_ENV
python-version: "3.10"

- name: Check environment variable
run: echo $SETUPTOOLS_SCM_PRETEND_VERSION
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
Expand All @@ -61,16 +32,8 @@ jobs:
--wheel
--outdir dist/
.
- name: Publish to Test PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM condaforge/mambaforge:22.11.1-4 as build

COPY docker_environment.yaml .
COPY ci/docker_environment.yaml .
RUN mkdir -p /mfa
RUN mamba env create -p /env -f docker_environment.yaml && conda clean -afy

Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion montreal_forced_aligner/command_line/mfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ def mfa_cli(ctx: click.Context) -> None:
run_check = True
if ctx.invoked_subcommand == "anchor":
os.environ[MFA_PROFILE_VARIABLE] = "anchor"
GLOBAL_CONFIG.profiles["anchor"].clean = False

GLOBAL_CONFIG.current_profile.clean = False
GLOBAL_CONFIG.save()
if "--help" in sys.argv or ctx.invoked_subcommand in [
"configure",
Expand Down

0 comments on commit 09fc6ae

Please sign in to comment.