Update add-to-conda-forge.yml #22
Workflow file for this run
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: Add to conda-forge | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
name: | |
type: string | |
description: PyPi package name | |
default: 'criclive' | |
github-username: | |
type: string | |
description: GitHub Username | |
default: 'aktech' | |
upstream-github-account: | |
type: string | |
description: Upstream github username (conda-forge) | |
default: 'aktech' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v3.0.1 | |
- name: Clone staged-reciped | |
run: | | |
git clone https://github.com/conda-forge/staged-recipes | |
- name: Install grayskull and hub | |
run: | | |
conda install -c conda-forge grayskull hub | |
- name: Generate recipe for package using grayskull | |
run: | | |
grayskull pypi ${{ github.event.inputs.name }} | |
ls -ltrh | |
ls ${{ github.event.inputs.name }}/meta.yaml | |
- name: Move recipe to staged recipe | |
run: | | |
cp ${{ github.event.inputs.name }} staged-recipes/recipes/ -r | |
ls staged-recipes/recipes/ | |
- name: Add github username to meta.yaml | |
run: | | |
meta_yaml=staged-recipes/recipes/${{ github.event.inputs.name }}/meta.yaml | |
sed -i 's/AddYourGitHubIdHere/${{ github.event.inputs.github-username }}/g' $meta_yaml | |
- name: Commit Recipe | |
run: | | |
cd staged-recipes | |
git add . | |
git status | |
git config --global user.email "dtu.amit@gmail.com" | |
git config --global user.name "Amit Kumar" | |
git commit -m "Add recipe for ${{ github.event.inputs.name }}" | |
- name: Add Fork remote | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
cd staged-recipes | |
git remote -v | |
github_username=${{ github.event.inputs.github-username }} | |
url=https://$github_username:$GH_TOKEN@github.com/$github_username/staged-recipes.git | |
git remote add fork $url | |
git remote -v | |
- name: Push recipe to the fork branch | |
run: | | |
cd staged-recipes | |
echo "Pushing recipe" | |
git checkout -b ${{ github.event.inputs.name }}-${GITHUB_SHA::7} | |
git push fork | |
- name: Get event type | |
run: | | |
echo ${{ github.event_name }} | |
# - name: Create a PR on conda-forge | |
# run: | | |
# echo "Creating a PR on conda-forge" | |
# cd staged-recipes | |
# branch=${{ github.event.inputs.name }}-${GITHUB_SHA::7} | |
# upstream_owner=${{ github.event.inputs.upstream-github-account }} | |
# hub pull-request -m "Add recipe for ${{ github.event.inputs.name }}" --base $upstream_owner:main --head ${{ github.event.inputs.github-username }}:$branch | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |