|
| 1 | +name: build addon |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: ["*"] |
| 6 | + # To build on main/master branch, uncomment the following line: |
| 7 | + # branches: [ main , master ] |
| 8 | + |
| 9 | + pull_request: |
| 10 | + branches: [ main, master ] |
| 11 | + |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - run: echo -e "pre-commit\nscons\nmarkdown">requirements.txt |
| 23 | + |
| 24 | + - name: Set up Python |
| 25 | + uses: actions/setup-python@v5 |
| 26 | + with: |
| 27 | + python-version: 3.11 |
| 28 | + cache: 'pip' |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + python -m pip install --upgrade pip wheel |
| 33 | + pip install -r requirements.txt |
| 34 | + sudo apt-get update -y |
| 35 | + sudo apt-get install -y gettext |
| 36 | +
|
| 37 | + - name: Code checks |
| 38 | + run: export SKIP=no-commit-to-branch; pre-commit run --all |
| 39 | + |
| 40 | + - name: building addon |
| 41 | + run: scons && scons pot |
| 42 | + |
| 43 | + - uses: actions/upload-artifact@v4 |
| 44 | + with: |
| 45 | + name: packaged_addon |
| 46 | + path: | |
| 47 | + ./*.nvda-addon |
| 48 | + ./*.pot |
| 49 | +
|
| 50 | + upload_release: |
| 51 | + runs-on: ubuntu-latest |
| 52 | + if: ${{ startsWith(github.ref, 'refs/tags/') }} |
| 53 | + needs: ["build"] |
| 54 | + permissions: |
| 55 | + contents: write |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v4 |
| 58 | + - name: download releases files |
| 59 | + uses: actions/download-artifact@v4 |
| 60 | + - name: Display structure of downloaded files |
| 61 | + run: ls -R |
| 62 | + - name: Calculate sha256 |
| 63 | + run: | |
| 64 | + echo -e "\nSHA256: " >> changelog.md |
| 65 | + sha256sum packaged_addon/*.nvda-addon >> changelog.md |
| 66 | +
|
| 67 | + - name: Release |
| 68 | + uses: softprops/action-gh-release@v2 |
| 69 | + with: |
| 70 | + files: | |
| 71 | + packaged_addon/*.nvda-addon |
| 72 | + packaged_addon/*.pot |
| 73 | + body_path: changelog.md |
| 74 | + fail_on_unmatched_files: true |
| 75 | + prerelease: ${{ contains(github.ref, '-') }} |
0 commit comments