From fc7072f6e34b2d33ffbc52bb1d3716310391c328 Mon Sep 17 00:00:00 2001 From: nvdaes Date: Sat, 3 Apr 2021 05:43:00 +0200 Subject: [PATCH] Update GitHub Actions --- .github/workflows/automaticRelease.yaml | 45 +++++++++++++++++++++ .github/workflows/checkForTranslations.yaml | 2 + .github/workflows/testWithNVDA.yaml | 22 +++++----- .github/workflows/upload-on-tag.yaml | 32 ++++++--------- 4 files changed, 69 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/automaticRelease.yaml diff --git a/.github/workflows/automaticRelease.yaml b/.github/workflows/automaticRelease.yaml new file mode 100644 index 00000000..643d40de --- /dev/null +++ b/.github/workflows/automaticRelease.yaml @@ -0,0 +1,45 @@ +name: pre-release + +on: + push: + branches: + - master + +jobs: + pre-release: + name: Pre Release + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + pip install scons markdown + sudo apt update + sudo apt install gettext + - name: Add add-on version + run: | + import re + with open("buildVars.py", 'r+', encoding='utf-8') as f: + text = f.read() + text = re.sub("\"addon_version\" : ,", "\"addon_version\" : \"${{ github.sha }}\",", text) + f.seek(0) + f.write(text) + f.truncate() + shell: python + - name: Build + run: scons + - name: Automatic release + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: latest + prerelease: true + title: Development Build + files: | + *.nvda-addon diff --git a/.github/workflows/checkForTranslations.yaml b/.github/workflows/checkForTranslations.yaml index a87891cd..a978a384 100644 --- a/.github/workflows/checkForTranslations.yaml +++ b/.github/workflows/checkForTranslations.yaml @@ -2,6 +2,8 @@ name: Check for l10n updates on: push: + branches: + - master schedule: # * is a special character in YAML so you have to quote this string diff --git a/.github/workflows/testWithNVDA.yaml b/.github/workflows/testWithNVDA.yaml index 3eef814b..20632d1f 100644 --- a/.github/workflows/testWithNVDA.yaml +++ b/.github/workflows/testWithNVDA.yaml @@ -1,9 +1,6 @@ name: Build and test NVDA add-on on: - push: - tags-ignore: - - '*' pull_request: branches: - master @@ -18,14 +15,13 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 - - name: Set up Python 3.7 + - name: Set up Python 3.8 uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: 3.8 - name: Install dependencies run: | - pip install scons - pip install Markdown + pip install scons markdown sudo apt update sudo apt install gettext - name: Add add-on version @@ -66,10 +62,10 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Set up Python 3.7 x86 + - name: Set up Python 3.8 x86 uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: 3.8 architecture: x86 - name: Checkout NVDA uses: actions/checkout@v2 @@ -93,13 +89,14 @@ jobs: Expand-Archive addon.zip source\userConfig\addons\addon - name: Start NVDA run: | - cd source - pythonw.exe nvda.pyw -m --debug-logging + runnvda -m --debug-logging ping 127.0.0.1 /n 20 + shell: cmd - name: Quit NVDA run: | - pythonw.exe nvda.pyw -q + runnvda -q ping 127.0.0.1 /n 20 + shell: cmd - name: Upload log uses: actions/upload-artifact@v2 with: @@ -109,7 +106,6 @@ jobs: run: | move *.pot tests\nvda.pot cd tests - python checkPot.py nvda.pot python checkPot.py nvda.pot > potResults.txt If (Select-String -Path potResults.txt -Pattern 'Message has no translator comment' -SimpleMatch) {exit 1} - name: Comment on PR diff --git a/.github/workflows/upload-on-tag.yaml b/.github/workflows/upload-on-tag.yaml index 30ef9740..25135cd9 100644 --- a/.github/workflows/upload-on-tag.yaml +++ b/.github/workflows/upload-on-tag.yaml @@ -7,19 +7,19 @@ on: jobs: buildAndUpload: - runs-on: windows-latest + runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - - name: Set up Python 3.7 + - name: Set up Python 3.8 uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: 3.8 - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install scons - pip install Markdown + pip install scons markdown + sudo apt update + sudo apt install gettext - name: Add add-on version run: | import re @@ -33,20 +33,14 @@ jobs: shell: python - name: Build add-on run: scons - - name: Create Release - uses: actions/create-release@latest + - name: Calculate sha256 + run: sha256sum *.nvda-addon >> changelog.md + - name: Release + uses: softprops/action-gh-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - prerelease: ${{ endsWith(github.ref, '-dev') }} + files: | + *.nvda-addon body_path: changelog.md - - name: Upload binaries to release - uses: svenstaro/upload-release-action@v1-release - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: '*.nvda-addon' - tag: ${{ github.ref }} - overwrite: true - file_glob: true + prerelease: ${{ endsWith(github.ref, '-dev') }}