Add more tasks #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.x" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Build | |
| run: make build | |
| - name: Release with incremented version | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| VERSION=$(cat version.txt 2>/dev/null || echo "1") | |
| echo $((VERSION + 1)) > version.txt | |
| tar -czf release-v${VERSION}.tar.gz release/ | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| git add version.txt | |
| git commit -m "Bump version to $((VERSION + 1))" | |
| git push | |
| - name: Upload release artifact | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release | |
| path: release-v*.tar.gz |