Skip to content

Update data files and publish #92

Update data files and publish

Update data files and publish #92

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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download latest IERS files
run: ./scripts/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@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.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@9f1f43251dde69da8613ea8e11144f05cdea41d5 # v1.15.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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
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@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
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@9f1f43251dde69da8613ea8e11144f05cdea41d5 # v1.15.0
with:
checkout_ref: ${{ needs.tag.outputs.new_tag }}
upload_to_pypi: true
secrets:
pypi_token: ${{ secrets.PYPI_TOKEN }}