-
Notifications
You must be signed in to change notification settings - Fork 61
71 lines (60 loc) · 1.96 KB
/
_UploadRelease.yml
File metadata and controls
71 lines (60 loc) · 1.96 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
name: _Upload release
on:
workflow_call:
permissions:
contents: write
jobs:
upload_release:
name: Upload all packages
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v6
- name: Download Linux artifact
uses: actions/download-artifact@v6
with:
name: Linux-sdist
path: dist
- name: Rename sdist to .src.tgz
run: |
cd dist
old_file=$(ls pymca5-*.tar.gz)
new_file=$(echo "$old_file" | sed 's/^pymca5-/pymca/' | sed 's/\.tar\.gz$/-src.tgz/')
mv "$old_file" "$new_file"
echo "Renamed $old_file → $new_file"
- name: Download the macOS universal2 artifact
uses: actions/download-artifact@v6
with:
name: macos-universal2-dmg
path: dist
- name: Download Windows artifact
uses: actions/download-artifact@v6
with:
name: windows-installer-cxfreeze
path: dist
- name: List all downloaded files
run: ls -R dist
- name: Extract version from __init__.py
id: get_version
shell: python
run: |
import os
path = 'src/PyMca5/__init__.py'
version = None
with open(path, 'r') as f:
for line in f:
if line.startswith('__version__'):
version = line.replace(' ', '').split('=')[-1].strip().strip('"\'')
break
assert version is not None, "Version not found in __init__.py"
print(version)
# Save version to GitHub output
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.write(f"version={version}\n")
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: "v${{ steps.get_version.outputs.version }}"
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}