|
1 |
| -name: Tox |
| 1 | +name: Build, Test, and Release sdist |
| 2 | + |
| 3 | +# reference: |
| 4 | +# - https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#contexts |
| 5 | +# - https://docs.github.com/en/actions/reference/environment-variables |
2 | 6 |
|
3 | 7 | on: [push]
|
4 | 8 |
|
@@ -51,17 +55,17 @@ jobs:
|
51 | 55 | - name: Display structure of downloaded files
|
52 | 56 | run: ls -aR ~/.toxsdistsrc/
|
53 | 57 | - name: Rename file
|
54 |
| - run: mv ~/.toxsdistsrc/django-tellme-*.zip /tmp/django-tellme-pre-${{ github.run_number }}-${{ github.sha }}.zip |
| 58 | + run: mv ~/.toxsdistsrc/django-tellme-*.zip /tmp/django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip |
55 | 59 | - name: Display tmp files
|
56 | 60 | run: ls /tmp
|
57 | 61 | - name: Run Tox
|
58 | 62 | # Run tox using the version of Python in `PATH`
|
59 |
| - run: python -m tox -vv --installpkg "/tmp/django-tellme-pre-${{ github.run_number }}-${{ github.sha }}.zip" |
| 63 | + run: python -m tox -vv --installpkg "/tmp/django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip" |
60 | 64 | env:
|
61 | 65 | DJANGO: ${{ matrix.django }}
|
62 | 66 |
|
63 |
| - prerelease: |
64 |
| - if: contains(github.event.head_commit.message, '[prerelease]') |
| 67 | + pre-release: |
| 68 | + if: startsWith(github.ref, 'refs/tags/p') |
65 | 69 | needs: test
|
66 | 70 | runs-on: ubuntu-latest
|
67 | 71 | steps:
|
|
73 | 77 | - name: Display structure of downloaded files
|
74 | 78 | run: ls -aR ~/.toxsdistsrc/
|
75 | 79 | - name: Rename file
|
76 |
| - run: mv ~/.toxsdistsrc/django-tellme-*.zip /tmp/django-tellme-pre-${{ github.run_number }}-${{ github.sha }}.zip |
| 80 | + run: mv ~/.toxsdistsrc/django-tellme-*.zip /tmp/django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip |
77 | 81 | - name: Display tmp files
|
78 | 82 | run: ls /tmp
|
79 | 83 | - name: Create Release
|
|
82 | 86 | env:
|
83 | 87 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
84 | 88 | with:
|
85 |
| - tag_name: pre-${{ github.run_number }}-${{ github.sha }} |
86 |
| - release_name: Pre-release ${{ github.run_number }} |
| 89 | + tag_name: ${{ github.ref }} |
| 90 | + release_name: Pre-release ${{ github.ref }} |
87 | 91 | draft: false
|
88 | 92 | prerelease: true
|
89 | 93 | - name: Upload Release Asset
|
|
93 | 97 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
94 | 98 | with:
|
95 | 99 | upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
96 |
| - asset_path: /tmp/django-tellme-pre-${{ github.run_number }}-${{ github.sha }}.zip |
97 |
| - asset_name: django-tellme-pre-${{ github.run_number }}-${{ github.sha }}.zip |
| 100 | + asset_path: /tmp/django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip |
| 101 | + asset_name: django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip |
| 102 | + asset_content_type: application/zip |
| 103 | + |
| 104 | + release: |
| 105 | + if: startsWith(github.ref, 'refs/tags/v') |
| 106 | + needs: test |
| 107 | + runs-on: ubuntu-latest |
| 108 | + steps: |
| 109 | + - name: Download sdist |
| 110 | + uses: actions/download-artifact@v2 |
| 111 | + with: |
| 112 | + name: sdist |
| 113 | + path: ~/.toxsdistsrc/ |
| 114 | + - name: Display structure of downloaded files |
| 115 | + run: ls -aR ~/.toxsdistsrc/ |
| 116 | + - name: Rename file |
| 117 | + run: mv ~/.toxsdistsrc/django-tellme-*.zip /tmp/django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip |
| 118 | + - name: Display tmp files |
| 119 | + run: ls /tmp |
| 120 | + - name: Create Release |
| 121 | + id: create_release |
| 122 | + uses: actions/create-release@v1 |
| 123 | + env: |
| 124 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 125 | + with: |
| 126 | + tag_name: ${{ github.ref }} |
| 127 | + release_name: Release ${{ github.ref }} |
| 128 | + draft: false |
| 129 | + prerelease: false |
| 130 | + - name: Upload Release Asset |
| 131 | + id: upload-release-asset |
| 132 | + uses: actions/upload-release-asset@v1 |
| 133 | + env: |
| 134 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 135 | + with: |
| 136 | + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps |
| 137 | + asset_path: /tmp/django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip |
| 138 | + asset_name: django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip |
98 | 139 | asset_content_type: application/zip
|
0 commit comments