Skip to content

Commit

Permalink
Add submodule update to release action
Browse files Browse the repository at this point in the history
  • Loading branch information
danlamanna committed Feb 16, 2023
1 parent edbb2f9 commit a64e806
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
path: dandischema
token: ${{ secrets.DANDI_GITHUB_TOKEN }}

Expand All @@ -73,25 +74,18 @@ jobs:
fi
echo "SCHEMA_VERSION=$SCHEMA_VERSION" >> "$GITHUB_ENV"
- name: Checkout dandi/schema
uses: actions/checkout@v3
with:
repository: dandi/schema
path: schema
token: ${{ secrets.DANDI_GITHUB_TOKEN }}

- name: Test for unversioned changes
run: |
dirs="$(echo releases/*)"
echo "Following directories will be checked for differences: $dirs"
python ../dandischema/tools/pubschemata.py releases
python ../../tools/pubschemata.py releases
git status
git add -A releases
if ! git diff --cached --exit-code $dirs
then echo "[ERROR] Existing schema files modified instead of creating a new version"
exit 1
fi
working-directory: schema
working-directory: dandischema/dandischema/schema

- name: Install build & twine
run: python -m pip install build twine
Expand All @@ -102,20 +96,11 @@ jobs:
wget -O- "$auto_download_url" | gunzip > ~/auto
chmod a+x ~/auto
- name: Create release
run: |
~/auto shipit -vv
python -m build
twine upload dist/*
env:
GH_TOKEN: ${{ secrets.DANDI_GITHUB_TOKEN }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
working-directory: dandischema
- name: Commit schema changes and create new tag
run: |
LIBRARY_VERSION="$(git -C ../dandischema describe --tags --exact-match)"
# TODO
LIBRARY_VERSION="$(auto shipit --dry-run | grep for version)"
git config --global user.email "[email protected]"
git config --global user.name "DANDI Bot"
Expand All @@ -124,10 +109,26 @@ jobs:
if ! git diff --quiet --cached
then git commit -m "Publish model schema v$SCHEMA_VERSION as of dandischema v$LIBRARY_VERSION"
git push
git -C ../dandischema tag -m "Schema v$SCHEMA_VERSION, released in dandischema v$LIBRARY_VERSION" schema-$SCHEMA_VERSION
git -C ../dandischema push --tags
else echo "No changes to commit"
fi
working-directory: schema

- name: Update schema submodule with new release
run: |
git submodule update
git commit -m "Schema v$SCHEMA_VERSION, released in dandischema v$LIBRARY_VERSION" schema-$SCHEMA_VERSION
git tag -m "Schema v$SCHEMA_VERSION, released in dandischema v$LIBRARY_VERSION" schema-$SCHEMA_VERSION
git push --tags
working-directory: dandischema

- name: Create release
run: |
~/auto shipit -vv
python -m build
twine upload dist/*
env:
GH_TOKEN: ${{ secrets.DANDI_GITHUB_TOKEN }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
working-directory: dandischema
# vim:set sts=2:

0 comments on commit a64e806

Please sign in to comment.