Skip to content

Update data files and publish #77

Update data files and publish

Update data files and publish #77

name: Update data files and publish
on:
schedule:
- cron: '0 0 * * MON'
workflow_dispatch:
jobs:
update:
name: Auto-update IERS tables
runs-on: ubuntu-latest
if: ${{ github.repository == 'astropy/astropy-iers-data' && github.ref_name == 'main' }}
outputs:
changed: ${{ steps.check.outputs.changed }}
new_sha: ${{ steps.commit.outputs.new_sha }}
steps:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Download latest IERS files
run: ./update_data.sh
- name: Check for changes
id: check
run: |
if ! git diff --exit-code; then
echo "changed=true" > $GITHUB_OUTPUT
else
echo "changed=false" > $GITHUB_OUTPUT
fi
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
if: steps.check.outputs.changed
with:
python-version: '3.x'
- name: Install tox
if: steps.check.outputs.changed
run: pip install tox
- name: Run preliminary tests
if: steps.check.outputs.changed
run: tox -e test
- name: Commit changes
id: commit
if: steps.check.outputs.changed
run: |
git config user.name github-actions
git config user.email [email protected]
git add astropy_iers_data/data
git commit -m "Update IERS Earth rotation and leap second tables"
git push
echo "new_sha=$(git rev-parse HEAD)" > $GITHUB_OUTPUT
tests:
name: Run tests on all platforms
needs: update
if: needs.update.outputs.changed
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@924441154cf3053034c6513d5e06c69d262fb9a6 # v1.13.0
with:
checkout_ref: ${{ needs.update.outputs.new_sha }}
envs: |
- linux: py310-test
- macos: py311-test
- windows: py312-test
tag:
name: Tag latest commit to main using calendar version
needs: tests
if: needs.update.outputs.changed
outputs:
new_tag: ${{ steps.tag_name.outputs.version }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
ref: ${{ needs.update.outputs.new_sha }}
- name: Get tag name from date
id: tag_name
run: echo "version=v0.$(date +'%Y.%-m.%-d.%-H.%-M.%-S')" > $GITHUB_OUTPUT
- name: Check tag
run: echo ${{ steps.tag_name.outputs.version }}
- name: Create tag
uses: mathieudutour/github-tag-action@a22cf08638b34d5badda920f9daf6e72c477b07b # v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.tag_name.outputs.version }}
tag_prefix: ""
- name: Create GitHub release
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
with:
tag_name: ${{ steps.tag_name.outputs.version }}
generate_release_notes: true
publish:
name: Publish the release to PyPI
needs: tag
if: needs.update.outputs.changed
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@924441154cf3053034c6513d5e06c69d262fb9a6 # v1.13.0
with:
checkout_ref: ${{ needs.tag.outputs.new_tag }}
upload_to_pypi: true
secrets:
pypi_token: ${{ secrets.PYPI_TOKEN }}