|
7 | 7 |
|
8 | 8 | jobs: |
9 | 9 | build: |
| 10 | + name: Create Release |
| 11 | + permissions: write-all |
10 | 12 | runs-on: ubuntu-latest |
11 | | - timeout-minutes: 60 |
12 | | - strategy: |
13 | | - matrix: |
14 | | - python-version: |
15 | | - - '3.10' |
16 | | - |
17 | 13 | steps: |
18 | | - - name: Checkout Repository |
19 | | - uses: actions/checkout@v3 |
20 | | - with: |
21 | | - fetch-depth: 0 |
22 | | - |
| 14 | + - name: Checkout code |
| 15 | + uses: actions/checkout@v2 |
| 16 | + - name: Get version from setup.cfg |
| 17 | + id: get-version |
| 18 | + run: echo "::set-output name=version::$(awk -F "=" '/^version/ {print $2}' setup.cfg | tr -d '[:space:]')" |
23 | 19 | - name: Create Release |
24 | 20 | id: create_release |
25 | 21 | uses: actions/create-release@v1 |
26 | 22 | env: |
27 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 23 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token |
28 | 24 | with: |
29 | | - tag_name: ${{ github.ref }} |
30 | | - release_name: Release ${{ github.ref }} |
| 25 | + tag_name: v${{ steps.get-version.outputs.version }} |
| 26 | + release_name: Release v${{ steps.get-version.outputs.version }} |
31 | 27 | draft: false |
32 | 28 | prerelease: ${{ contains(github.ref, '-beta') || contains(github.ref, '-alpha') || contains(github.ref, '-rc') }} |
33 | | - |
34 | | - - name: Extract Tag Name |
35 | | - id: get_version |
36 | | - run: echo "VERSION=${GITHUB_REF/refs/tags/}" >> $GITHUB_ENV |
37 | | - |
38 | | - - name: Set Up Python ${{ matrix.python-version }} |
39 | | - uses: actions/setup-python@v4 |
40 | | - with: |
41 | | - python-version: ${{ matrix.python-version }} |
42 | | - |
43 | | - - name: Install Dependencies |
44 | | - run: | |
45 | | - python -m pip install --upgrade pip setuptools wheel build |
46 | | -
|
47 | | - - name: Build Package |
48 | | - run: python -m build |
49 | | - |
50 | | - - name: Upload Release Asset |
51 | | - id: upload-release-asset |
52 | | - uses: actions/upload-release-asset@v1 |
53 | | - env: |
54 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
55 | | - with: |
56 | | - upload_url: ${{ steps.create_release.outputs.upload_url }} |
57 | | - asset_path: dist/* |
58 | | - asset_name: package.zip |
59 | | - asset_content_type: application/zip |
0 commit comments