|
1 | | -name: CI |
| 1 | +name: Build and Release |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: [ master ] |
| 5 | + branches: [main] |
6 | 6 | pull_request: |
7 | | - branches: [ master ] |
| 7 | + branches: [main] |
8 | 8 |
|
9 | 9 | jobs: |
10 | 10 | build: |
11 | 11 | runs-on: ubuntu-latest |
12 | 12 |
|
13 | 13 | steps: |
14 | | - - uses: actions/checkout@v4 |
15 | | - |
16 | | - - name: Set up Python |
17 | | - uses: actions/setup-python@v4 |
18 | | - with: |
19 | | - python-version: '3.x' |
20 | | - |
21 | | - - name: Install dependencies |
22 | | - run: | |
23 | | - python -m pip install --upgrade pip |
24 | | - pip install -r requirements.txt |
25 | | -
|
26 | | - - name: Build |
27 | | - run: make build |
28 | | - |
29 | | - - name: Release with incremented version |
30 | | - if: github.ref == 'refs/heads/master' |
31 | | - run: | |
32 | | - VERSION=$(cat version.txt 2>/dev/null || echo "1") |
33 | | - echo $((VERSION + 1)) > version.txt |
34 | | - tar -czf release-v${VERSION}.tar.gz release/ |
35 | | - git config --local user.email "action@github.com" |
36 | | - git config --local user.name "GitHub Action" |
37 | | - git add version.txt |
38 | | - git commit -m "Bump version to $((VERSION + 1))" |
39 | | - git push |
40 | | -
|
41 | | - - name: Upload release artifact |
42 | | - if: github.ref == 'refs/heads/master' |
43 | | - uses: actions/upload-artifact@v3 |
44 | | - with: |
45 | | - name: release |
46 | | - path: release-v*.tar.gz |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Set up Python |
| 17 | + uses: actions/setup-python@v4 |
| 18 | + with: |
| 19 | + python-version: "3.x" |
| 20 | + |
| 21 | + - name: Install dependencies |
| 22 | + run: | |
| 23 | + python -m pip install --upgrade pip |
| 24 | + pip install -r requirements.txt |
| 25 | +
|
| 26 | + - name: Build |
| 27 | + run: make build |
| 28 | + |
| 29 | + - name: Release with incremented version |
| 30 | + if: github.ref == 'refs/heads/main' |
| 31 | + run: | |
| 32 | + VERSION=$(cat version.txt 2>/dev/null || echo "1") |
| 33 | + echo $((VERSION + 1)) > version.txt |
| 34 | + tar -czf release-v${VERSION}.tar.gz release/ |
| 35 | + git config --local user.email "action@github.com" |
| 36 | + git config --local user.name "GitHub Action" |
| 37 | + git add version.txt |
| 38 | + git commit -m "Bump version to $((VERSION + 1))" |
| 39 | + git push |
| 40 | +
|
| 41 | + - name: Upload release artifact |
| 42 | + if: github.ref == 'refs/heads/main' |
| 43 | + uses: actions/upload-artifact@v4 |
| 44 | + with: |
| 45 | + name: release |
| 46 | + path: release-v*.tar.gz |
0 commit comments