-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (114 loc) · 3.74 KB
/
Copy pathrelease.yml
File metadata and controls
131 lines (114 loc) · 3.74 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build-release-artifacts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
registry-url: https://registry.npmjs.org
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- run: npm ci
- run: npm --prefix dashboard ci
- run: npm run lint
- run: npm run typecheck
- run: npm test
- run: npm run build
- run: npm --prefix dashboard run build
- run: npm run package:check
- run: mkdir -p release-artifacts
- run: npm pack --pack-destination release-artifacts
- run: python -m pip install --upgrade pip build twine
- run: python -m pip install -e "python-sdk[dev]"
- run: python -m pytest python-sdk/tests -q
- run: python -m build python-sdk --outdir python-sdk/dist
- run: python -m twine check python-sdk/dist/*
- run: mkdir -p release-artifacts/python-dist
- run: cp python-sdk/dist/* release-artifacts/
- run: cp python-sdk/dist/* release-artifacts/python-dist/
- run: tar -czf release-artifacts/dashboard-dist-${{ github.ref_name }}.tar.gz -C dashboard dist
- run: find release-artifacts -maxdepth 1 -type f ! -name 'sha256sums.txt' -print0 | xargs -0 sha256sum > release-artifacts/sha256sums.txt
- name: Generate release notes
run: |
TAG="${{ github.ref_name }}"
PREV_TAG=$(git describe --tags --abbrev=0 "${TAG}^" 2>/dev/null || echo "")
if [ -n "$PREV_TAG" ]; then
CHANGELOG=$(git log --pretty=format:"- %s" "${PREV_TAG}..${TAG}" -- ':!.planning' | grep -v "^- Merge pull request")
else
CHANGELOG="- Initial release"
fi
cat > release-artifacts/release-notes.md <<EOF
## Changes
${CHANGELOG}
## Artifacts
- \`govyn\` npm package tarball
- \`govynai\` wheel and source distribution
- packaged dashboard build
- \`sha256sums.txt\`
EOF
- uses: actions/upload-artifact@v7
with:
name: release-artifacts
path: release-artifacts/
if-no-files-found: error
publish-npm:
needs: build-release-artifacts
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
environment:
name: npm
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
registry-url: https://registry.npmjs.org
- run: npm ci
- run: npm run build
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-pypi:
needs: build-release-artifacts
runs-on: ubuntu-latest
permissions:
id-token: write
environment:
name: pypi
steps:
- uses: actions/download-artifact@v8
with:
name: release-artifacts
path: release-artifacts
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: release-artifacts/python-dist
github-release:
needs: [build-release-artifacts, publish-npm, publish-pypi]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
name: release-artifacts
path: release-artifacts
- uses: softprops/action-gh-release@v2
with:
body_path: release-artifacts/release-notes.md
files: |
release-artifacts/*.tgz
release-artifacts/*.whl
release-artifacts/*.tar.gz
release-artifacts/sha256sums.txt