Skip to content

Commit 6318d43

Browse files
authored
fix: no manifest rp #154
* fix: introduced config and reduced testing requirement (#154) * fix: rename config file (#154) * fix: adding manifest (#154) * fix: back to simple mode (#154) * fix: removed reference (#154) * fix: reformat * fix: switch to complex setup files (#154) * fix: updated releaseplease config and job * fix: updated manifest * fix: trying more steps * fix: removed manifest file * fix: removed manifest reference
1 parent 10818f6 commit 6318d43

4 files changed

Lines changed: 125 additions & 73 deletions

File tree

.github/workflows/publish.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

.github/workflows/python-unittest.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Python Tests ChurchToolsAPI
22

3-
on: [ push, pull_request ]
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
pull_request:
48

59
env:
610
CT_TOKEN: ${{ secrets.CT_TOKEN }}

.github/workflows/release.yml

Lines changed: 108 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,117 @@
11
name: 1. Release-Please
22

33
on:
4-
push:
5-
branches:
6-
- main
4+
push:
5+
branches:
6+
- main
77
permissions:
8-
contents: write
9-
pull-requests: write
8+
contents: write
9+
pull-requests: write
1010

1111
jobs:
12-
release-please:
12+
release:
1313
runs-on: ubuntu-latest
14+
outputs:
15+
upload_url: ${{ steps.release.outputs.upload_url }}
16+
version: ${{ steps.release.outputs.version }}
17+
tag_name: ${{ steps.release.outputs.tag_name }}
18+
release_created: ${{ steps.release.outputs.release_created }}
1419
steps:
15-
- uses: googleapis/release-please-action@v4
20+
- id: release
21+
name: release
22+
uses: googleapis/release-please-action@v4
1623
with:
17-
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
18-
release-type: python
24+
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
25+
config-file: .release-please-config.json
26+
- name: Debug release outputs
27+
run: |
28+
echo "release_created=${{ steps.release.outputs.release_created }}"
29+
echo "version=${{ steps.release.outputs.version }}"
30+
echo "tag_name=${{ steps.release.outputs.tag_name }}"
31+
echo "upload_url=${{ steps.release.outputs.upload_url }}"
32+
33+
upload-assets:
34+
runs-on: ubuntu-latest
35+
needs: release
36+
if: needs.release.outputs.release_created == 'true'
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4.2.1
40+
41+
- name: Set up Python
42+
uses: actions/setup-python@v5.2.0
43+
with:
44+
python-version: 3.x
45+
46+
- name: Install Poetry
47+
run: |
48+
pip install poetry
49+
poetry config virtualenvs.create false # Skip creating a virtual environment
50+
env:
51+
POETRY_HOME: ${{ github.workspace }}/.poetry
52+
53+
- name: Install project dependencies
54+
run: poetry install
55+
env:
56+
POETRY_HOME: ${{ github.workspace }}/.poetry
57+
58+
- name: Build package
59+
run: poetry build
60+
env:
61+
POETRY_HOME: ${{ github.workspace }}/.poetry
62+
63+
- name: Set up GitHub CLI
64+
uses: cli/gh-action@v2
65+
with:
66+
token: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Upload dist/* to release
69+
run: |
70+
release_id=$(gh api \
71+
-H "Accept: application/vnd.github+json" \
72+
/repos/${{ github.repository }}/releases/tags/${{ needs.release.outputs.tag_name }} \
73+
--jq .id)
74+
75+
for file in dist/*; do
76+
echo "Uploading $file"
77+
gh api \
78+
--method POST \
79+
-H "Accept: application/vnd.github+json" \
80+
-H "Content-Type: application/octet-stream" \
81+
"/repos/${{ github.repository }}/releases/$release_id/assets?name=$(basename "$file")" \
82+
--input "$file"
83+
done
84+
85+
- name: Append custom release notes
86+
run: |
87+
release_id=$(gh api \
88+
-H "Accept: application/vnd.github+json" \
89+
/repos/${{ github.repository }}/releases/tags/${{ needs.release.outputs.tag_name }} \
90+
--jq .id)
91+
92+
# Fetch existing release body
93+
existing_body=$(gh api /repos/${{ github.repository }}/releases/$release_id --jq .body)
94+
95+
# Create temporary file for new body
96+
tmpfile=$(mktemp)
97+
98+
# Write combined content into the file
99+
{
100+
echo "$existing_body"
101+
echo
102+
echo "Automated Release preparation using Git Tag"
103+
echo " - make sure tests didn't fail"
104+
echo " - needs to be published from draft online"
105+
echo
106+
echo "Install as package using:"
107+
echo '```bash'
108+
echo "pip install git+https://github.com/bensteUEM/ChurchToolsAPI.git@${{ needs.release.outputs.version }}#egg=churchtools-api"
109+
echo '```'
110+
} > "$tmpfile"
111+
112+
# Update the release body using the file
113+
gh api \
114+
-X PATCH \
115+
-H "Accept: application/vnd.github+json" \
116+
/repos/${{ github.repository }}/releases/$release_id \
117+
-F body="$(cat "$tmpfile")"

.release-please-config.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
{
2-
"release-type": "python",
3-
"branches": [
4-
{
5-
"branch": "main"
6-
}
7-
]
8-
}
2+
"release-type": "python",
3+
"branches": [
4+
{
5+
"branch": "main"
6+
}
7+
],
8+
"packages": {
9+
"churchtools_api": {}
10+
},
11+
"draft": true,
12+
"tagPrefix": ""
13+
}

0 commit comments

Comments
 (0)