|
| 1 | +name: Release and Publish package to PyPI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + |
| 8 | +jobs: |
| 9 | + release: |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + include: |
| 14 | + # https://github.com/actions/runner-images#available-images |
| 15 | + - os: ubuntu-latest |
| 16 | + locale: C.UTF-8 |
| 17 | + env: |
| 18 | + LC_ALL: ${{ matrix.locale }} |
| 19 | + LANG: ${{ matrix.locale }} |
| 20 | + steps: |
| 21 | + ##### Setup environment |
| 22 | + # https://github.com/actions/checkout |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + - name: Set up Python |
| 25 | + # https://github.com/actions/setup-python |
| 26 | + uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: 3.8 |
| 29 | + cache: "pip" |
| 30 | + - name: Upgrade pip and setuptools |
| 31 | + # https://pypi.org/project/pip/ |
| 32 | + # https://pypi.org/project/setuptools/ |
| 33 | + # https://pypi.org/project/wheel/ |
| 34 | + run: python -m pip install --upgrade pip setuptools==65.6.3 wheel |
| 35 | + - name: Print info about the current python installation |
| 36 | + run: make ci-info |
| 37 | + - name: Install requirements |
| 38 | + run: make bootstrap-dev |
| 39 | + - name: Check or download gh utility |
| 40 | + run: | |
| 41 | + if ! which gh; then |
| 42 | + echo "Downloading 'gh' utility" |
| 43 | + if [ "$(uname -s)" = "Linux" ]; then |
| 44 | + curl -L -o gh.tar.gz https://github.com/cli/cli/releases/download/v2.28.0/gh_2.28.0_linux_amd64.tar.gz |
| 45 | + tar xzf gh.tar.gz |
| 46 | + mv ./gh_2.28.0_linux_amd64/bin/gh /usr/local/bin/gh |
| 47 | + else |
| 48 | + curl -L -o gh.zip https://github.com/cli/cli/releases/download/v2.28.0/gh_2.28.0_macOS_amd64.zip |
| 49 | + unzip xzf gh.zip |
| 50 | + mv ./gh_2.28.0_macOS_amd64/bin/gh /usr/local/bin/gh |
| 51 | + fi |
| 52 | + which gh |
| 53 | + fi |
| 54 | +
|
| 55 | + ##### Create release on GitHub |
| 56 | + - name: Create or update GitHub release |
| 57 | + run: scriv github-release --repo=codewithemad/tutor-contrib-wordpress |
| 58 | + env: |
| 59 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments