-
Notifications
You must be signed in to change notification settings - Fork 9
97 lines (76 loc) · 2.29 KB
/
publish.yaml
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
name: Publish
env:
# Enable colored output
# https://github.com/actions/runner/issues/241
PY_COLORS: 1
POETRY_VERSION: "1.6.1"
on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- main
permissions:
contents: read
jobs:
publish-packages:
name: python-${{ matrix.python-version }}, ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- "3.12"
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Poetry
run: |
pipx install poetry==${{ env.POETRY_VERSION }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install zsh
run: |
sudo apt-get update
sudo apt-get install zsh
- name: Install packages
run: |
poetry install
- name: Collect scenarios
run: |
scenarios=(scenarios/**/*.json)
# Display for debug
for scenario in $scenarios
do
echo "$scenario"
done
echo "SCENARIOS=$scenarios" >> "$GITHUB_ENV"
# Assigning a glob to a variable in `bash` is such a pain I don't want to talk about it
# instead we just use zsh
shell: zsh {0}
- name: View scenarios
run: |
poetry run packse view $SCENARIOS
- name: Build scenarios
run: |
poetry run packse build $SCENARIOS
- name: Publish scenarios [local]
if: github.ref != 'refs/heads/main'
run: |
# Start the local index server, do not allow packages from PyPI
index_url=$(poetry run packse index up --bg --offline)
# Publish the packages
poetry run packse publish --anonymous --index-url "$index_url" dist/*
# Shutdown the index server
poetry run packse index down
- name: Publish scenarios [test pypi]
if: github.ref == 'refs/heads/main'
env:
PACKSE_PUBLISH_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
poetry run packse publish --skip-existing dist/*