Skip to content

Commit 31a67ef

Browse files
Change paths in tests after universal dmg package. Add bahaviour for empty secret for PyPI and testPyPI. Add local option fro release - no uploads, no tags, no version check.
1 parent 9886b68 commit 31a67ef

File tree

6 files changed

+41
-13
lines changed

6 files changed

+41
-13
lines changed

.github/workflows/Release.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@ on:
99
workflow_dispatch:
1010
inputs:
1111
force:
12-
description: 'Force release even if version was not changed'
13-
required: false
14-
default: 'false'
15-
# change to 'true' for manual release
12+
description: |
13+
stop - do nothing; safe precautions from accident run
14+
force - to start release with same version (useful if previous CI failed before uploading wheels)
15+
local - to test changes; it create only artifacts, no upload or tag
16+
type: choice
17+
options:
18+
- stop
19+
- force
20+
- local
21+
default: 'stop'
22+
1623
push:
1724
branches:
1825
- master
@@ -43,9 +50,12 @@ jobs:
4350
if [[ -n "$changed" ]]; then
4451
echo "Version changed"
4552
echo "should_release=true" >> $GITHUB_OUTPUT
46-
elif [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.force }}" == "true" ]]; then
53+
elif [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.force }}" == "force" ]]; then
4754
echo "Release was triggered manually"
4855
echo "should_release=true" >> $GITHUB_OUTPUT
56+
elif [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.force }}" == "local" ]]; then
57+
echo "Not release but local test was started"
58+
echo "should_release=true" >> $GITHUB_OUTPUT
4959
else
5060
echo "No release... for now"
5161
echo "should_release=false" >> $GITHUB_OUTPUT
@@ -55,12 +65,14 @@ jobs:
5565
needs: version-change
5666
if: needs.version-change.outputs.should_release == 'true'
5767
uses: ./.github/workflows/_Version.yml
68+
with:
69+
skipper: ${{ github.event.inputs.force }}
5870

5971
run-build-upload:
6072
needs: version-check
6173
uses: ./.github/workflows/_Wheels.yml
6274
secrets:
63-
TESTPYPI_PASSWORD: ${{ secrets.TESTPYPI_PASSWORD }}
75+
TESTPYPI_PASSWORD: ${{ github.event.inputs.force != 'local' && secrets.TESTPYPI_PASSWORD || '' }}
6476

6577
trigger-windows-pyinstaller:
6678
needs: run-build-upload
@@ -75,6 +87,7 @@ jobs:
7587
uses: ./.github/workflows/_MacOS.yml
7688

7789
tag-release:
90+
if: github.event.inputs.force != 'local'
7891
permissions:
7992
contents: write
8093
needs:
@@ -83,12 +96,14 @@ jobs:
8396
uses: ./.github/workflows/_TagRelease.yml
8497

8598
changelog:
99+
if: github.event.inputs.force != 'local'
86100
permissions:
87101
contents: write
88102
needs: tag-release
89103
uses: ./.github/workflows/_ChangeLog.yml
90104

91105
upload-release:
106+
if: github.event.inputs.force != 'local'
92107
permissions:
93108
contents: write
94109
needs: tag-release
@@ -98,7 +113,7 @@ jobs:
98113
needs: tag-release
99114
uses: ./.github/workflows/_PyPI.yml
100115
secrets:
101-
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
116+
PYPI_PASSWORD: ${{ github.event.inputs.force != 'local' && secrets.PYPI_PASSWORD || '' }}
102117

103118

104119

.github/workflows/_MacOS.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,21 +410,21 @@ jobs:
410410
- name: Copy .app to /Applications
411411
run: |
412412
set -e
413-
APP_PATH="/Volumes/${{ env.APP_BASE_NAME }}/${{ env.APP_NAME }}"
413+
APP_PATH="/Volumes/${{ env.APP_BASE_NAME }}/PyMca.app"
414414
sudo cp -R "$APP_PATH" /Applications/
415415
416416
- name: Make main binary executable
417-
run: chmod +x /Applications/${{ env.APP_NAME }}/Contents/MacOS/PyMcaMain
417+
run: chmod +x /Applications/PyMca.app/Contents/MacOS/PyMcaMain
418418

419419
- name: Run the x86_64 tests
420420
run: |
421421
set -e
422-
arch -x86_64 /Applications/${{ env.APP_NAME }}/Contents/MacOS/PyMcaMain --test
422+
arch -x86_64 /Applications/PyMca.app/Contents/MacOS/PyMcaMain --test
423423
424424
- name: Run the arm64 tests
425425
run: |
426426
set -e
427-
arch -arm64 /Applications/${{ env.APP_NAME }}/Contents/MacOS/PyMcaMain --test
427+
arch -arm64 /Applications/PyMca.app/Contents/MacOS/PyMcaMain --test
428428
429429
- name: Unmount the DMG
430430
if: always()

.github/workflows/_PyPI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
python -m pip install --upgrade twine
4242
4343
- name: Upload to PyPI
44+
if: ${{ inputs.PYPI_PASSWORD != '' }}
4445
env:
4546
TWINE_USERNAME: __token__
4647
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/_UploadRelease.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
run: |
2525
cd dist
2626
old_file=$(ls pymca5-*.tar.gz)
27-
new_file=$(echo "$old_file" | sed 's/^pymca5-/pymca/' | sed 's/\.tar\.gz$/.src.tgz/')
27+
new_file=$(echo "$old_file" | sed 's/^pymca5-/pymca/' | sed 's/\.tar\.gz$/-src.tgz/')
2828
mv "$old_file" "$new_file"
2929
echo "Renamed $old_file → $new_file"
3030

.github/workflows/_Version.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: _Check version
22

33
on:
4-
workflow_dispatch:
54
workflow_call:
5+
inputs:
6+
skipper:
7+
type: string
8+
required: false
69

710
env:
811
PROJECT: PyMca5
@@ -11,6 +14,7 @@ env:
1114
jobs:
1215
check-version-exists:
1316
runs-on: ubuntu-latest
17+
if: ${{ inputs.skipper != 'local' }}
1418
steps:
1519
- name: Checkout code
1620
uses: actions/checkout@v2
@@ -82,3 +86,10 @@ jobs:
8286
exit(1)
8387
else:
8488
print(f"✅ Version {version} is new and OK to publish")
89+
90+
skipper:
91+
runs-on: ubuntu-latest
92+
if: ${{ inputs.skipper == 'local' }}
93+
steps:
94+
- name: Pass
95+
run: echo "Skipping version check because of local run"

.github/workflows/_Wheels.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ jobs:
350350
find dist -type f \( -name '*.whl' -o -name '*.tar.gz' \)
351351
352352
- name: Upload wheels to TestPyPI
353+
if: ${{ inputs.TESTPYPI_PASSWORD != '' }}
353354
env:
354355
TWINE_USERNAME: __token__
355356
TWINE_PASSWORD: ${{ secrets.TESTPYPI_PASSWORD }}

0 commit comments

Comments
 (0)