|
6 | 6 | - '*.*.*'
|
7 | 7 |
|
8 | 8 | jobs:
|
9 |
| - |
10 |
| - Linux: |
11 |
| - runs-on: ubuntu-latest |
12 |
| - |
13 |
| - steps: |
14 |
| - - uses: actions/checkout@v2 |
15 |
| - - name: Get tag |
16 |
| - id: tag |
17 |
| - run: | |
18 |
| - echo ::set-output name=tag::${GITHUB_REF#refs/tags/} |
19 |
| - - name: Set up Python ${{ matrix.python-version }} |
20 |
| - uses: actions/setup-python@v1 |
21 |
| - with: |
22 |
| - python-version: 3.8 |
23 |
| - - name: Install and set up Poetry |
24 |
| - run: | |
25 |
| - curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py |
26 |
| - python get-poetry.py --preview -y |
27 |
| - - name: Build distributions |
28 |
| - run: | |
29 |
| - source $HOME/.poetry/env |
30 |
| - poetry build -vvv |
31 |
| - - name: Upload distribution artifacts |
32 |
| - uses: actions/upload-artifact@v1 |
33 |
| - with: |
34 |
| - name: pendulum-dist |
35 |
| - path: dist |
36 |
| - |
37 |
| - MacOS: |
38 |
| - runs-on: macos-latest |
39 |
| - |
40 |
| - steps: |
41 |
| - - uses: actions/checkout@v2 |
42 |
| - - name: Get tag |
43 |
| - id: tag |
44 |
| - run: | |
45 |
| - echo ::set-output name=tag::${GITHUB_REF#refs/tags/} |
46 |
| - - name: Set up Python ${{ matrix.python-version }} |
47 |
| - uses: actions/setup-python@v1 |
48 |
| - with: |
49 |
| - python-version: 3.8 |
50 |
| - - name: Install and set up Poetry |
51 |
| - run: | |
52 |
| - curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py |
53 |
| - python get-poetry.py --preview -y |
54 |
| - - name: Build distributions |
55 |
| - run: | |
56 |
| - source $HOME/.poetry/env |
57 |
| - poetry build -vvv |
58 |
| - - name: Upload distribution artifacts |
59 |
| - uses: actions/upload-artifact@v1 |
60 |
| - with: |
61 |
| - name: pendulum-dist |
62 |
| - path: dist |
63 |
| - |
64 |
| - Windows: |
65 |
| - runs-on: windows-latest |
66 |
| - |
67 |
| - steps: |
68 |
| - - uses: actions/checkout@v2 |
69 |
| - - name: Get tag |
70 |
| - id: tag |
71 |
| - shell: bash |
72 |
| - run: | |
73 |
| - echo ::set-output name=tag::${GITHUB_REF#refs/tags/} |
74 |
| - - name: Set up Python ${{ matrix.python-version }} |
75 |
| - uses: actions/setup-python@v1 |
76 |
| - with: |
77 |
| - python-version: 3.8 |
78 |
| - - name: Install and setup Poetry |
79 |
| - run: | |
80 |
| - Invoke-WebRequest https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -O get-poetry.py |
81 |
| - python get-poetry.py --preview -y |
82 |
| - - name: Build distributions |
83 |
| - run: | |
84 |
| - $env:Path += ";$env:Userprofile\.poetry\bin" |
85 |
| - poetry build -vvv |
86 |
| - - name: Upload distribution artifact |
87 |
| - uses: actions/upload-artifact@v1 |
88 |
| - with: |
89 |
| - name: pendulum-dist |
90 |
| - path: dist |
91 |
| - |
92 | 9 | Release:
|
93 |
| - needs: [Linux, MacOS, Windows] |
94 | 10 | runs-on: ubuntu-latest
|
95 | 11 |
|
96 | 12 | steps:
|
97 | 13 | - name: Checkout code
|
98 | 14 | uses: actions/checkout@v2
|
| 15 | + |
99 | 16 | - name: Get tag
|
100 | 17 | id: tag
|
101 |
| - run: | |
102 |
| - echo ::set-output name=tag::${GITHUB_REF#refs/tags/} |
103 |
| - - name: Download distribution artifact |
104 |
| - uses: actions/download-artifact@master |
| 18 | + run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/} |
| 19 | + |
| 20 | + - name: Set up Python 3.9 |
| 21 | + uses: actions/setup-python@v2 |
105 | 22 | with:
|
106 |
| - name: pendulum-dist |
107 |
| - path: dist |
108 |
| - - name: Install and set up Poetry |
109 |
| - run: | |
110 |
| - curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py |
111 |
| - python get-poetry.py --preview -y |
112 |
| - - name: Check distributions |
| 23 | + python-version: "3.9" |
| 24 | + |
| 25 | + - name: Install Poetry |
113 | 26 | run: |
|
114 |
| - ls -la dist |
115 |
| - - name: Publish to PyPI |
116 |
| - env: |
117 |
| - POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} |
| 27 | + curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py \ |
| 28 | + | python - -y |
| 29 | +
|
| 30 | + - name: Update PATH |
| 31 | + run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 32 | + |
| 33 | + - name: Build project for distribution |
| 34 | + run: poetry build |
| 35 | + |
| 36 | + - name: Check Version |
| 37 | + id: check-version |
118 | 38 | run: |
|
119 |
| - source $HOME/.poetry/env |
120 |
| - poetry publish |
| 39 | + [[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \ |
| 40 | + || echo ::set-output name=prerelease::true |
| 41 | +
|
121 | 42 | - name: Create Release
|
122 |
| - id: create_release |
123 |
| - uses: actions/create-release@v1 |
124 |
| - env: |
125 |
| - GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} |
| 43 | + uses: ncipollo/release-action@v1 |
126 | 44 | with:
|
127 |
| - tag_name: ${{ steps.tag.outputs.tag }} |
128 |
| - release_name: ${{ steps.tag.outputs.tag }} |
| 45 | + artifacts: "dist/*" |
| 46 | + token: ${{ secrets.GITHUB_TOKEN }} |
129 | 47 | draft: false
|
130 |
| - prerelease: false |
| 48 | + prerelease: steps.check-version.outputs.prerelease == 'true' |
| 49 | + |
| 50 | + - name: Publish to PyPI |
| 51 | + env: |
| 52 | + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} |
| 53 | + run: poetry publish |
0 commit comments