Skip to content

Commit 6ba7e7f

Browse files
authored
🩹Fix publish workflow (#783)
* 🩹Fix publish workflow * 🩹 * FUCK * Fix JSON schemas * stable redirects to version marked as latest
1 parent 7869518 commit 6ba7e7f

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

.github/workflows/python-publish.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Set up Python ${{ matrix.python-version }}
3939
uses: actions/setup-python@v5
4040
with:
41-
python-version: ${{ matrix.python-version }}
41+
python-version: "3.12"
4242
- name: Install tox
4343
run: |
4444
python -m pip install --upgrade pip
@@ -65,6 +65,9 @@ jobs:
6565
# in the BO4E-Schemas repo. For this we have to retrieve the commits SHA via the API first.
6666
# For this, we use the lightweight tool jq (https://stedolan.github.io/jq/) to parse the JSON
6767
# response from the API.
68+
- name: Install dependencies for creating release
69+
run: |
70+
pip install requests click
6871
- name: Tag and release the new version in BO4E-Schemas
6972
run: python bo4e_schemas_create_release.py
7073
env:
@@ -83,12 +86,17 @@ jobs:
8386
- name: Set up Python
8487
uses: actions/setup-python@v5
8588
with:
86-
python-version: ${{ matrix.python-version }}
89+
python-version: "3.12"
8790
- name: Install dependencies
8891
run: |
8992
python -m pip install --upgrade pip
93+
pip install tox
9094
pip install -r requirements.txt
9195
# Note: The sphinx action below can only install a single requirements file.
96+
- name: Build JSON Schemas
97+
run: tox -e generate_json_schemas
98+
env:
99+
TARGET_VERSION: ${{ github.ref_name }}
92100
- name: Run kroki with docker
93101
run: |
94102
docker compose up -d
@@ -105,14 +113,16 @@ jobs:
105113
env:
106114
SPHINX_DOCS_RELEASE: ${{ github.ref_name }}
107115
SPHINX_DOCS_VERSION: ${{ github.ref_name }}
108-
- id: latest_bo4e
109-
name: Get latest BO4E release tag
110-
uses: pozetroninc/github-action-get-latest-release@master
111-
with:
112-
repository: ${{ github.repository }}
113-
token: ${{ secrets.GITHUB_TOKEN }}
116+
- name: Export LATEST_TAG
117+
run: |
118+
echo "LATEST_TAG=$(curl -qsSL \
119+
-H "Accept: application/vnd.github+json" \
120+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
121+
-H "X-GitHub-Api-Version: 2022-11-28" \
122+
"${{ github.api_url }}/repos/${{ github.repository }}/releases/latest" \
123+
| jq -r .tag_name)" >> $GITHUB_ENV
114124
- name: Redirect stable to new release if the new release is marked as latest
115-
if: steps.latest_bo4e.outputs.release == github.ref_name
125+
if: ${{ env.LATEST_TAG == github.ref_name }}
116126
run: |
117127
echo "Redirecting stable to new version ${{ github.ref_name }}"
118128
rm -rf stable

0 commit comments

Comments
 (0)