-
-
Notifications
You must be signed in to change notification settings - Fork 8
107 lines (97 loc) · 3.08 KB
/
update_and_publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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@v4
- 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@v5
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@main
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@v4
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/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.tag_name.outputs.version }}
tag_prefix: ""
- name: Create GitHub release
uses: softprops/action-gh-release@v2
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@main
with:
checkout_ref: ${{ needs.tag.outputs.new_tag }}
upload_to_pypi: true
secrets:
pypi_token: ${{ secrets.PYPI_TOKEN }}