Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate incrementing the dev-label conda build #706

Merged
merged 1 commit into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/actions/utils/increment_conda_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

from shutil import copyfile

# Open existing meta.yaml and another one
metayaml = open('meta.yaml')
outyaml = open('out.yaml', 'w')

# Find the build number, increment it, and write to the new yaml
found = False
for line in metayaml:
if "number:" in line:
found = True
# For the line containing the build number, parse the number and increment
elements = [e.strip() for e in line.split(":")]
if not elements[1].isnumeric():
raise ValueError("Build number is not parsable: {}".format(line))

old_build_number = int(elements[1])
new_build_number = old_build_number + 1

# Write new build number to new yaml
outyaml.write(line.replace(str(old_build_number), str(new_build_number)))
else:
# Write all other lines to new yaml
outyaml.write(line)

if not found:
raise Exception("Error incrementing the build number.")

# Clean up
metayaml.close()
outyaml.close()

# Replace original meta.yaml with the new one
copyfile('out.yaml', 'meta.yaml')
46 changes: 46 additions & 0 deletions .github/workflows/conda-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

name: 'Conda Deployment Pipeline'

on:
push:
paths-ignore:
- 'docs/**'
- 'share/**'
- 'vs-build/**'
branches:
- 'dev'

jobs:
update-dev:
runs-on: ubuntu-20.04
steps:
# - name: Echo path
# run: |
# echo ${{runner.workspace}} # /home/runner/work/openfast
# echo $GITHUB_WORKSPACE # /home/runner/work/openfast/openfast
- name: Checkout OpenFAST/dev
uses: actions/checkout@main
with:
path: ${{runner.workspace}}/openfast
ref: dev

- name: Checkout openfast-feedstock
uses: actions/checkout@main
with:
repository: conda-forge/openfast-feedstock
token: ${{ secrets.ACTIONS_TOKEN }}
path: ./openfast-feedstock
ref: dev

- name: Prep the meta.yaml
run: python ${{runner.workspace}}/openfast/.github/actions/utils/increment_conda_build.py
working-directory: ./openfast-feedstock/recipe

- name: Push Project B
run: |
cd ./openfast-feedstock
git add recipe/meta.yaml
git config user.name github-actions
git config user.email github-actions@github.com
git commit -m "Increment build number for dev label"
git push