|
5 | 5 | types: |
6 | 6 | - published |
7 | 7 |
|
8 | | -env: |
9 | | - PUBLISH_UPDATE_BRANCH: main |
10 | | - GIT_USER_NAME: "TEAM 4.0[bot]" |
11 | | - GIT_USER_EMAIL: "Team4.0@SINTEF.no" |
12 | | - |
13 | 8 | jobs: |
14 | | - update-and-publish: |
15 | | - name: Update CHANGELOG and version and publish to PyPI |
16 | | - runs-on: ubuntu-latest |
| 9 | + publish-package-and-docs: |
| 10 | + name: Call external workflow |
| 11 | + uses: CasperWA/gh-actions/.github/workflows/cd_release.yml@main |
17 | 12 | if: github.repository == 'SINTEF/oteapi-optimade' && startsWith(github.ref, 'refs/tags/v') |
18 | | - |
19 | | - steps: |
20 | | - - name: Checkout repository |
21 | | - uses: actions/checkout@v3 |
22 | | - with: |
23 | | - fetch-depth: 0 |
24 | | - |
25 | | - - name: Set up Python 3.9 |
26 | | - uses: actions/setup-python@v4 |
27 | | - with: |
28 | | - python-version: "3.9" |
29 | | - |
30 | | - - name: Install Python dependencies |
31 | | - run: | |
32 | | - python -m pip install -U pip |
33 | | - pip install -U setuptools wheel flit |
34 | | - pip install -U -e .[dev] |
35 | | -
|
36 | | - - name: Update changelog |
37 | | - uses: CharMixer/auto-changelog-action@v1 |
38 | | - with: |
39 | | - token: ${{ secrets.GITHUB_TOKEN }} |
40 | | - release_branch: ${{ env.PUBLISH_UPDATE_BRANCH }} |
41 | | - |
42 | | - - name: Set up git user |
43 | | - run: | |
44 | | - git config --global user.name "${GIT_USER_NAME}" |
45 | | - git config --global user.email "${GIT_USER_EMAIL}" |
46 | | -
|
47 | | - - name: Update version and tag |
48 | | - run: | |
49 | | - invoke setver --version="${GITHUB_REF#refs/tags/}" |
50 | | -
|
51 | | - git add oteapi_optimade/__init__.py tests/static/test_optimade_config.yml CHANGELOG.md |
52 | | - git commit -m "Release ${GITHUB_REF#refs/tags/} - Changelog" |
53 | | -
|
54 | | - TAG_MSG=.github/utils/release_tag_msg.txt |
55 | | - sed -i "s|TAG_NAME|${GITHUB_REF#refs/tags/}|" "${TAG_MSG}" |
56 | | - git tag -af -F "${TAG_MSG}" ${GITHUB_REF#refs/tags/} |
57 | | -
|
58 | | - - name: Build source distribution |
59 | | - run: | |
60 | | - # First, clean the git tree |
61 | | - git checkout -- . |
62 | | - flit build |
63 | | -
|
64 | | - - name: Update '${{ env.PUBLISH_UPDATE_BRANCH }}' |
65 | | - uses: CasperWA/push-protected@v2 |
66 | | - with: |
67 | | - token: ${{ secrets.RELEASE_PAT }} |
68 | | - branch: ${{ env.PUBLISH_UPDATE_BRANCH }} |
69 | | - sleep: 15 |
70 | | - force: true |
71 | | - tags: true |
72 | | - unprotect_reviews: true |
73 | | - |
74 | | - - name: Get tagged versions |
75 | | - run: echo "PREVIOUS_VERSION=$(git tag -l --sort -version:refname | sed -n 2p)" >> $GITHUB_ENV |
76 | | - |
77 | | - - name: Create release-specific changelog |
78 | | - uses: CharMixer/auto-changelog-action@v1 |
79 | | - with: |
80 | | - token: ${{ secrets.GITHUB_TOKEN }} |
81 | | - release_branch: ${{ env.PUBLISH_UPDATE_BRANCH }} |
82 | | - since_tag: "${{ env.PREVIOUS_VERSION }}" |
83 | | - output: "release_changelog.md" |
84 | | - |
85 | | - - name: Append changelog to release body |
86 | | - run: | |
87 | | - gh api /repos/${{ github.repository }}/releases/${{ github.event.release.id }} --jq '.body' > release_body.md |
88 | | - cat release_changelog.md >> release_body.md |
89 | | - gh api /repos/${{ github.repository }}/releases/${{ github.event.release.id }} -X PATCH -F body='@release_body.md' |
90 | | - env: |
91 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
92 | | - |
93 | | - - name: Publish package to PyPI |
94 | | - uses: pypa/gh-action-pypi-publish@v1.5.0 |
95 | | - with: |
96 | | - user: __token__ |
97 | | - password: ${{ secrets.PYPI_TOKEN }} |
98 | | - |
99 | | - docs: |
100 | | - name: Deploy release documentation |
101 | | - needs: update-and-publish |
102 | | - runs-on: ubuntu-latest |
103 | | - |
104 | | - steps: |
105 | | - - name: Checkout repository |
106 | | - uses: actions/checkout@v3 |
107 | | - with: |
108 | | - fetch-depth: 0 |
109 | | - ref: ${{ env.PUBLISH_UPDATE_BRANCH }} |
110 | | - |
111 | | - - name: Set up Python 3.9 |
112 | | - uses: actions/setup-python@v4 |
113 | | - with: |
114 | | - python-version: "3.9" |
115 | | - |
116 | | - - name: Install Python dependencies |
117 | | - run: | |
118 | | - python -m pip install -U pip |
119 | | - pip install -U setuptools wheel flit |
120 | | - pip install -U -e .[doc] |
121 | | -
|
122 | | - - name: Set up git user |
123 | | - run: | |
124 | | - git config --global user.name "${{ env.GIT_USER_NAME }}" |
125 | | - git config --global user.email "${{ env.GIT_USER_EMAIL }}" |
126 | | -
|
127 | | - - name: Deploy documentation |
128 | | - run: | |
129 | | - mike deploy --push --remote origin --branch gh-pages --update-aliases --config-file mkdocs.yml ${GITHUB_REF#refs/tags/v} stable |
130 | | - mike deploy --push --remote origin --branch gh-pages --update-aliases --config-file mkdocs.yml latest ${{ env.PUBLISH_UPDATE_BRANCH }} |
| 13 | + with: |
| 14 | + package_dir: oteapi_optimade |
| 15 | + git_username: "TEAM 4.0[bot]" |
| 16 | + git_email: "Team4.0@SINTEF.no" |
| 17 | + release_branch: main |
| 18 | + install_extras: "[dev]" |
| 19 | + python_version: "3.9" |
| 20 | + update_docs: true |
| 21 | + doc_extras: "[doc]" |
| 22 | + build_cmd: "pip install -U flit && flit build" |
| 23 | + test: true |
| 24 | + secrets: |
| 25 | + PyPI_token: ${{ secrets.TESTPYPI_TOKEN }} |
| 26 | + release_PAT: ${{ secrets.RELEASE_PAT }} |
0 commit comments