Newer
Older
thu-learn-downloader-optimized / .github / workflows / cd.yaml
name: Continuous Delivery

on:
  push:
  pull_request:

jobs:
  build:
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - windows-latest
          - macos-latest
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout
        uses: actions/[email protected]
      - name: Setup Python
        uses: actions/[email protected]
        with:
          python-version: "3.10"
      - name: Install Dependencies
        run: |
          python -m pip install --upgrade pip
          pip install --requirement requirements.txt
          pip install pyinstaller
      - name: Build
        run: |
          pyinstaller --onefile main.py --name thu-learn-downloader-${{ matrix.os }}
      - name: Upload a Build Artifact
        uses: actions/[email protected]
        with:
          name: thu-learn-downloader-${{ matrix.os }}
          path: dist/*

  release:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/[email protected]
      - name: Download a Build Artifact
        uses: actions/[email protected]
        with:
          path: dist/
      - name: GitHub Tag
        id: tag_version
        uses: mathieudutour/[email protected]
        with:
          github_token: ${{ github.token }}
          default_bump: false
      - if: ${{ steps.tag_version.outputs.new_tag }}
        name: Release
        uses: softprops/[email protected]
        with:
          tag_name: ${{ steps.tag_version.outputs.new_tag }}
          body: ${{ steps.tag_version.outputs.changelog }}
          files: |
            identity.yaml
            dist/**/*