forked from maxibor/conda-package-publish-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update for more platforms for the packages
- Loading branch information
1 parent
6dd7f82
commit 621cea8
Showing
5 changed files
with
176 additions
and
162 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
FROM continuumio/miniconda3:4.7.10 | ||
|
||
LABEL "repository"="https://github.com/m0nhawk/conda-package-publish-action" | ||
LABEL "maintainer"="Andrew Prokhorenkov <andrew.prokhorenkov@gmail.com>" | ||
|
||
RUN conda install -y anaconda-client conda-build | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
FROM continuumio/miniconda3:4.7.10 | ||
|
||
LABEL "repository"="https://github.com/m0nhawk/conda-package-publish-action" | ||
LABEL "maintainer"="Andrew Prokhorenkov <andrew.prokhorenkov@gmail.com>" | ||
|
||
RUN conda install -y anaconda-client conda-build | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Roman Joeres | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
MIT License | ||
Copyright (c) 2023 Roman Joeres | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,52 @@ | ||
# Publish Anaconda Package | ||
|
||
A Github Action to publish your software package to an Anaconda repository. | ||
|
||
### Example workflow to publish to conda every time you make a new release | ||
|
||
```yaml | ||
name: publish_conda | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: publish-to-conda | ||
uses: Old-Shatterhand/publish-conda-multichannel-action@v0.0.5 | ||
with: | ||
subDir: 'conda' | ||
AnacondaToken: ${{ secrets.ANACONDA_TOKEN }} | ||
Channels: 'pytorch,rdkit' | ||
Versions: '38,311' | ||
``` | ||
|
||
### Example project structure | ||
|
||
``` | ||
. | ||
├── LICENSE | ||
├── README.md | ||
├── myproject | ||
│ ├── __init__.py | ||
│ └── myproject.py | ||
├── conda | ||
│ ├── build.sh | ||
│ └── meta.yaml | ||
├── .github | ||
│ └── workflows | ||
│ └── publish_conda.yml | ||
├── .gitignore | ||
``` | ||
|
||
### ANACONDA_TOKEN | ||
|
||
1. Get an Anaconda token (with read and write API access) at `anaconda.org/USERNAME/settings/access` | ||
2. Add it to the Secrets of the Github repository as `ANACONDA_TOKEN` | ||
|
||
### Build Channels | ||
By Default, this Github Action will search for conda build dependancies (on top of the standard channels) in `conda-forge` and `bioconda` | ||
# Publish Anaconda Package | ||
|
||
A Github Action to publish your software package to an Anaconda repository. | ||
|
||
### Example workflow to publish to conda every time you make a new release | ||
|
||
```yaml | ||
name: publish_conda | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: publish-to-conda | ||
uses: Old-Shatterhand/publish-conda-multichannel-action@v0.0.5 | ||
with: | ||
subDir: 'conda' | ||
AnacondaToken: ${{ secrets.ANACONDA_TOKEN }} | ||
Channels: 'pytorch,rdkit' | ||
Versions: '38,311' | ||
``` | ||
|
||
### Example project structure | ||
|
||
``` | ||
. | ||
├── LICENSE | ||
├── README.md | ||
├── myproject | ||
│ ├── __init__.py | ||
│ └── myproject.py | ||
├── conda | ||
│ ├── build.sh | ||
│ └── meta.yaml | ||
├── .github | ||
│ └── workflows | ||
│ └── publish_conda.yml | ||
├── .gitignore | ||
``` | ||
|
||
### ANACONDA_TOKEN | ||
|
||
1. Get an Anaconda token (with read and write API access) at `anaconda.org/USERNAME/settings/access` | ||
2. Add it to the Secrets of the Github repository as `ANACONDA_TOKEN` | ||
|
||
### Build Channels | ||
By Default, this Github Action will search for conda build dependancies (on top of the standard channels) in `conda-forge` and `bioconda` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
name: 'Publish Conda package to Anaconda.org using custom channels for build' | ||
description: 'Build and Publish conda package to Anaconda' | ||
author: 'Andrew Prokhorenkov, modified by Maxime Borry, further modified by Roman Joeres' | ||
branding: | ||
icon: 'package' | ||
color: 'purple' | ||
inputs: | ||
subDir: | ||
description: 'Sub-directory with conda recipe' | ||
default: '.' | ||
AnacondaToken: | ||
description: 'Anaconda access Token' | ||
Channels: | ||
description: 'List of conda channels to include in the building process.' | ||
Versions: | ||
description: 'List of python versions to build on. Shall be given as 26, 38, or 311' | ||
Folder: | ||
description: 'Folder to search for the meta.yaml' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
name: 'Publish Conda package to Anaconda.org using custom channels for build' | ||
description: 'Build and Publish conda package to Anaconda' | ||
author: 'Andrew Prokhorenkov, modified by Maxime Borry, further modified by Roman Joeres' | ||
branding: | ||
icon: 'package' | ||
color: 'purple' | ||
inputs: | ||
subDir: | ||
description: 'Sub-directory with conda recipe' | ||
default: '.' | ||
AnacondaToken: | ||
description: 'Anaconda access Token' | ||
Channels: | ||
description: 'List of conda channels to include in the building process.' | ||
Versions: | ||
description: 'List of python versions to build on. Shall be given as 26, 38, or 311.' | ||
Folder: | ||
description: 'Folder to search for the meta.yaml' | ||
Platforms: | ||
description: 'list of platforms to build package for. Default is linux-64.' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,71 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
set -o pipefail | ||
|
||
go_to_build_dir() { | ||
if [ ! -z $INPUT_SUBDIR ]; then | ||
cd $INPUT_SUBDIR | ||
fi | ||
} | ||
|
||
check_if_meta_yaml_file_exists() { | ||
if [ ! -f meta.yaml ]; then | ||
echo "meta.yaml must exist in the directory that is being packaged and published." | ||
exit 1 | ||
fi | ||
} | ||
|
||
build_package(){ | ||
channels=$(echo $INPUT_CHANNELS | tr "," "\n") | ||
versions=$(echo $INPUT_VERSIONS | tr "," "\n") | ||
|
||
# may be replaced by {'python': [$INPUT_VERSIONS]} | ||
build_command="conda-build --variants \"{'python': [" | ||
for version in $versions; do | ||
build_command+="'$version', " | ||
done | ||
build_command=${build_command::-2} | ||
build_command+="]}\"" | ||
|
||
build_command+=" -c conda-forge -c bioconda" | ||
for channel in $channels; do | ||
build_command+=" -c $channel" | ||
done | ||
|
||
build_command+=" --output-folder . --no-test " | ||
if [ -z $INPUT_FOLDER ] | ||
then | ||
build_command+="." | ||
else | ||
build_command+="$INPUT_FOLDER" | ||
fi | ||
|
||
echo "Execute command: $build_command" | ||
eval "$build_command" | ||
|
||
conda convert -p osx-64 linux-64/*.tar.bz2 | ||
} | ||
|
||
upload_package(){ | ||
export ANACONDA_API_TOKEN=$INPUT_ANACONDATOKEN | ||
anaconda upload --label main linux-64/*.tar.bz2 | ||
anaconda upload --label main osx-64/*.tar.bz2 | ||
} | ||
|
||
go_to_build_dir | ||
# check_if_meta_yaml_file_exists | ||
build_package | ||
upload_package | ||
#!/bin/bash | ||
|
||
set -ex | ||
set -o pipefail | ||
|
||
go_to_build_dir() { | ||
if [ ! -z $INPUT_SUBDIR ]; then | ||
cd $INPUT_SUBDIR | ||
fi | ||
} | ||
|
||
check_if_meta_yaml_file_exists() { | ||
if [ ! -f meta.yaml ]; then | ||
echo "meta.yaml must exist in the directory that is being packaged and published." | ||
exit 1 | ||
fi | ||
} | ||
|
||
build_package(){ | ||
channels=$(echo $INPUT_CHANNELS | tr "," "\n") | ||
versions=$(echo $INPUT_VERSIONS | tr "," "\n") | ||
platforms=$(echo $INPUT_PLATFORMS | tr "," "\n") | ||
|
||
# may be replaced by {'python': [$INPUT_VERSIONS]} | ||
build_command="conda-build --variants \"{'python': [" | ||
for version in $versions; do | ||
build_command+="'$version', " | ||
done | ||
build_command=${build_command::-2} | ||
build_command+="]}\"" | ||
|
||
build_command+=" -c conda-forge -c bioconda" | ||
for channel in $channels; do | ||
build_command+=" -c $channel" | ||
done | ||
|
||
build_command+=" --output-folder . --no-test " | ||
if [ -z $INPUT_FOLDER ] | ||
then | ||
build_command+="." | ||
else | ||
build_command+="$INPUT_FOLDER" | ||
fi | ||
|
||
echo "Execute command: $build_command" | ||
eval "$build_command" | ||
|
||
for platform in $platforms; do | ||
cmd="conda convert -p $platform linux-64/*.tar.bz2" | ||
echo "Convert command: $cmd" | ||
eval cmd | ||
done | ||
} | ||
|
||
upload_package(){ | ||
platforms=$(echo $INPUT_PLATFORMS | tr "," "\n") | ||
|
||
export ANACONDA_API_TOKEN=$INPUT_ANACONDATOKEN | ||
|
||
anaconda upload --label main linux-64/*.tar.bz2 | ||
|
||
for platform in $platforms; do | ||
cmd="anaconda upload --label main $platform/*.tar.bz2" | ||
echo "Upload command: $cmd" | ||
eval cmd | ||
} | ||
|
||
go_to_build_dir | ||
# check_if_meta_yaml_file_exists | ||
build_package | ||
upload_package |