|
1 | 1 | name: Test & Release
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - tags: |
6 |
| - - '*' |
7 |
| -# pull_request: |
8 |
| -# branches: |
9 |
| -# - master |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + # pull_request: |
| 7 | + # branches: |
| 8 | + # - master |
10 | 9 |
|
11 | 10 | jobs:
|
12 |
| - create-release: |
13 |
| - permissions: |
14 |
| - contents: write # for actions/create-release to create a release |
15 |
| - name: create-release |
16 |
| - runs-on: ubuntu-latest |
17 |
| - outputs: |
18 |
| - upload_url: ${{ steps.release.outputs.upload_url }} |
19 |
| - release_version: ${{ env.RELEASE_VERSION }} |
20 |
| - steps: |
21 |
| - - name: Harden Runner |
22 |
| - uses: step-security/harden-runner@c8454efe5d0bdefd25384362fe217428ca277d57 # v1 |
23 |
| - with: |
24 |
| - disable-sudo: true |
25 |
| - egress-policy: block |
26 |
| - allowed-endpoints: > |
27 |
| - api.github.com:443 |
28 |
| -
|
29 |
| - - name: Get the release version from the tag |
30 |
| - shell: bash |
31 |
| - if: env.RELEASE_VERSION == '' |
32 |
| - run: | |
33 |
| - # See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027 |
34 |
| - echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV |
35 |
| - echo "version is: ${{ env.RELEASE_VERSION }}" |
36 |
| -
|
37 |
| - - name: Create GitHub release |
38 |
| - id: release |
39 |
| - uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1 |
40 |
| - env: |
41 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
42 |
| - with: |
43 |
| - tag_name: ${{ env.RELEASE_VERSION }} |
44 |
| - release_name: ${{ env.RELEASE_VERSION }} |
45 |
| - |
46 | 11 | linux:
|
47 | 12 | runs-on: ubuntu-latest
|
48 |
| - needs: create-release |
49 | 13 | strategy:
|
50 | 14 | matrix:
|
51 | 15 | platform: [ 'x86_64-unknown-linux-gnu', 'aarch64-unknown-linux-gnu' ]
|
|
92 | 56 |
|
93 | 57 | windows:
|
94 | 58 | runs-on: windows-latest
|
95 |
| - needs: create-release |
96 | 59 | strategy:
|
97 | 60 | matrix:
|
98 | 61 | target: [x64]
|
|
123 | 86 |
|
124 | 87 | macos:
|
125 | 88 | runs-on: macos-latest
|
126 |
| - needs: create-release |
127 | 89 | strategy:
|
128 | 90 | matrix:
|
129 | 91 | python-version: ['3.8', '3.9', '3.10', '3.11']
|
@@ -161,6 +123,43 @@ jobs:
|
161 | 123 | name: wheels
|
162 | 124 | path: dist
|
163 | 125 |
|
| 126 | + python-release-github: |
| 127 | + runs-on: ubuntu-latest |
| 128 | + needs: [ macos, windows, linux ] |
| 129 | + permissions: |
| 130 | + contents: write # To add assets to a release. |
| 131 | + steps: |
| 132 | + - name: Harden Runner |
| 133 | + uses: step-security/harden-runner@18bf8ad2ca49c14cbb28b91346d626ccfb00c518 # v2.1.0 |
| 134 | + with: |
| 135 | + egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs |
| 136 | + |
| 137 | + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 |
| 138 | + with: |
| 139 | + ref: ${{ github.head_ref }} |
| 140 | + |
| 141 | + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 |
| 142 | + with: |
| 143 | + profile: minimal |
| 144 | + toolchain: stable |
| 145 | + |
| 146 | + - name: Set up Python 3.8 |
| 147 | + uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0 |
| 148 | + with: |
| 149 | + python-version: 3.8 |
| 150 | + |
| 151 | + - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 |
| 152 | + with: |
| 153 | + name: wheels |
| 154 | + path: wheels |
| 155 | + |
| 156 | + - name: Upload release binaries |
| 157 | + uses: alexellis/upload-assets@259de5111cb56966d046ced998941e93f91d2c93 |
| 158 | + env: |
| 159 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 160 | + with: |
| 161 | + asset_paths: '["./wheels/tantivy-*"]' |
| 162 | + |
164 | 163 | # release-pypy:
|
165 | 164 | # name: Release
|
166 | 165 | # runs-on: ubuntu-latest
|
|
0 commit comments