|
| 1 | +name: Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + - pre/* |
| 7 | + pull_request: |
| 8 | + types: [closed] |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write # for checkout |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + name: Build |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Install git |
| 19 | + run: | |
| 20 | + sudo apt update |
| 21 | + sudo apt install -y git |
| 22 | + - name: Install Python Env and Poetry |
| 23 | + uses: actions/setup-python@v5 |
| 24 | + with: |
| 25 | + python-version: '3.9.19' |
| 26 | + - run: pip install poetry |
| 27 | + - name: Install Node Env |
| 28 | + uses: actions/setup-node@v4 |
| 29 | + with: |
| 30 | + node-version: 20 |
| 31 | + - name: Checkout |
| 32 | + |
| 33 | + with: |
| 34 | + fetch-depth: 0 |
| 35 | + persist-credentials: false |
| 36 | + - name: Build app |
| 37 | + run: | |
| 38 | + poetry install |
| 39 | + poetry build |
| 40 | + id: build_cache |
| 41 | + if: success() |
| 42 | + - name: Cache build |
| 43 | + uses: actions/cache@v2 |
| 44 | + with: |
| 45 | + path: ./dist |
| 46 | + key: ${{ runner.os }}-build-${{ hashFiles('dist/**') }} |
| 47 | + if: steps.build_cache.outputs.id != '' |
| 48 | + |
| 49 | + release: |
| 50 | + name: Release |
| 51 | + runs-on: ubuntu-latest |
| 52 | + needs: build |
| 53 | + environment: development |
| 54 | + if: | |
| 55 | + github.event_name == 'push' && github.ref == 'refs/heads/main' || |
| 56 | + github.event_name == 'push' && github.ref == 'refs/heads/pre/beta' || |
| 57 | + github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged && github.event.pull_request.base.ref == 'main' || |
| 58 | + github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged && github.event.pull_request.base.ref == 'pre/beta' |
| 59 | + permissions: |
| 60 | + contents: write |
| 61 | + issues: write |
| 62 | + pull-requests: write |
| 63 | + id-token: write |
| 64 | + steps: |
| 65 | + - name: Checkout repo |
| 66 | + |
| 67 | + with: |
| 68 | + fetch-depth: 0 |
| 69 | + persist-credentials: false |
| 70 | + - name: Semantic Release |
| 71 | + |
| 72 | + with: |
| 73 | + semantic_version: 23 |
| 74 | + extra_plugins: | |
| 75 | + semantic-release-pypi |
| 76 | + @semantic-release/git |
| 77 | + @semantic-release/commit-analyzer |
| 78 | + @semantic-release/release-notes-generator |
| 79 | + @semantic-release/github |
| 80 | + @semantic-release/changelog |
| 81 | + conventional-changelog-conventionalcommits |
| 82 | + env: |
| 83 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 84 | + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} |
0 commit comments