forked from KeNaCo/auto-changelog
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (76 loc) · 2.13 KB
/
create-release.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
name: Create release
run-name: Create release linked to ${{ github.head_ref }}
on:
pull_request:
types:
- closed
paths:
- "changelog.md"
- "CHANGELOG.md"
jobs:
release:
if: startsWith(github.head_ref, 'version/') && github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
tag: ${{ steps.generate-release.outputs.tag }}
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- id: generate-release
name: Generate tag & release
uses: LeMimit/foxy-project/actions/create-release@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
build:
runs-on: ubuntu-latest
needs: release
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Install python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up pip cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('deps/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install pipx
run: |
python3 -m pip install --user pipx
python3 -m pipx ensurepath
- name: Install Hatch
run: pipx install hatch
- name: Install Hatch
run: hatch build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: python-artifacts
path: dist/*
if-no-files-found: error
publish:
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download Python artifacts
uses: actions/download-artifact@v4
with:
name: python-artifacts
path: dist
- name: Push Python artifacts to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.11
with:
skip-existing: true