-
Notifications
You must be signed in to change notification settings - Fork 12
136 lines (116 loc) · 4.16 KB
/
Copy pathrelease.yml
File metadata and controls
136 lines (116 loc) · 4.16 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Semantic Release
on:
push:
branches:
- main
# default: least privileged permissions across all jobs
permissions:
contents: read
jobs:
# Tests run automatically on push to main via tests.yml
# Branch protection rules ensure tests pass before this workflow runs
release:
runs-on: ubuntu-latest
outputs:
released: ${{ steps.release.outputs.released }}
tag: ${{ steps.release.outputs.tag }}
concurrency:
group: ${{ github.workflow }}-release-${{ github.ref_name }}
cancel-in-progress: false
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Generate bot app token
id: generate_token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1
with:
app-id: ${{ secrets.MY_RELEASER_ID }}
private-key: ${{ secrets.MY_RELEASER_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
token: ${{ steps.generate_token.outputs.token }}
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.10"
cache: 'pip'
- name: Cache Poetry virtualenv
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/pypoetry/virtualenvs
~/.cache/pip
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry==2.0.1
poetry install
- name: Action | Semantic Version Release
id: release
uses: python-semantic-release/python-semantic-release@350c48fcb3ffcdfd2e0a235206bc2ecea6b69df0
with:
github_token: ${{ steps.generate_token.outputs.token }}
git_committer_name: "semantic-release"
git_committer_email: "semantic-release@users.noreply.github.com"
build: false
- name: Debug | Check if CHANGELOG.md exists and show git status
if: steps.release.outputs.released == 'true'
run: |
echo "=== Checking CHANGELOG.md ==="
if [ -f CHANGELOG.md ]; then
echo "✅ CHANGELOG.md exists"
echo "File size: $(wc -c < CHANGELOG.md) bytes"
echo "Last 20 lines:"
tail -20 CHANGELOG.md
else
echo "❌ CHANGELOG.md does NOT exist"
fi
echo ""
echo "=== Git Status ==="
git status
echo ""
echo "=== Git Log (last commit) ==="
git log -1 --stat
- name: Build package
if: steps.release.outputs.released == 'true'
run: poetry build
- name: Publish | Upload to GitHub Release Assets
uses: python-semantic-release/publish-action@310a9983a0ae878b29f3aac778d7c77c1db27378
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ steps.generate_token.outputs.token }}
tag: ${{ steps.release.outputs.tag }}
- name: Upload | Distribution Artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: steps.release.outputs.released == 'true'
with:
name: distribution-artifacts
path: dist
if-no-files-found: error
deploy:
runs-on: ubuntu-latest
needs: release
if: ${{ needs.release.outputs.released == 'true' }}
environment:
name: pypi
url: https://pypi.org/p/goodmap
permissions:
contents: read
id-token: write
steps:
- name: Setup | Download Build Artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: distribution-artifacts
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
with:
packages-dir: dist