-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (79 loc) · 2.6 KB
/
publish.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Publish
on:
push:
branches:
- main
tags-ignore:
- "*"
jobs:
# -------------
release:
name: Create A Release
if: github.ref == 'refs/heads/main'
permissions:
contents: write
id-token: write
outputs:
TAG: ${{ steps.semver.outputs.nextStrict }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Personal Access Token enables git push in actions (repo contents permission)
token: ${{ secrets.PAT }}
- name: Calculate next version
id: semver
uses: ietf-tools/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get current version
id: current
run: echo "version=$(pipx run hatch version | tr -d '\n')" >> $GITHUB_OUTPUT
- if: ${{ steps.current.outputs.version == steps.semver.outputs.nextStrict || !steps.current.outputs.version }}
run: exit 1
- name: Commit version change and tag
run: |
git config --global user.name 'GitHub Automation'
git config --global user.email 'automation[bot]@leocov.com'
git tag ${{ steps.semver.outputs.nextStrict }}
git push --tags
- name: Create Build
run: pipx run hatch build -t wheel --clean
- name: Generate Build Signatures
uses: sigstore/[email protected]
with:
inputs: ./dist/*
- name: Generate Changelog
id: changelog
uses: requarks/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.semver.outputs.nextStrict }}
excludeScopes: "release"
- uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"
tag: ${{ steps.semver.outputs.nextStrict }}
name: "Release v${{ steps.semver.outputs.nextStrict }}"
body: ${{ steps.changelog.outputs.changelog }}
# -------------
pypi:
name: Publish to PyPi
needs: [ release ]
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/p/pyside-app-core
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Release Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release download ${{ needs.release.outputs.TAG }} --dir dist -p "*.whl" -p "*.tar.gz"
# trusted publishing workflow:
# https://docs.pypi.org/trusted-publishers/adding-a-publisher/
- name: Publish To PyPi
uses: pypa/gh-action-pypi-publish@release/v1.9