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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.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@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.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 github-actions@github.com 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@2835f0cacddf3f8de198db9afdb5354a5cebe0ef # v2.6.3 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: [update, tests] if: needs.update.outputs.changed outputs: new_tag: ${{ steps.tag_name.outputs.version }} runs-on: ubuntu-latest permissions: contents: write env: GH_TOKEN: ${{ github.token }} steps: - name: Checkout code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.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 run: gh release create ${{ steps.tag_name.outputs.version }} --generate-notes publish: name: Publish the release to PyPI needs: [update, tag] if: needs.update.outputs.changed uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@2835f0cacddf3f8de198db9afdb5354a5cebe0ef # v2.6.3 with: checkout_ref: ${{ needs.tag.outputs.new_tag }} upload_to_pypi: true secrets: pypi_token: ${{ secrets.PYPI_TOKEN }}