diff --git a/.github/workflows/upload-on-tag.yaml b/.github/workflows/upload-on-tag.yaml index 679a742..5ef32eb 100644 --- a/.github/workflows/upload-on-tag.yaml +++ b/.github/workflows/upload-on-tag.yaml @@ -1,25 +1,31 @@ +permissions: + contents: write name: Upload on new tags - on: push: tags: - '*' + ['*'] + workflow_dispatch: jobs: - buildAndUpload: + build: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 + uses: actions/checkout@v3 + - run: echo -e "pre-commit\nscons\nmarkdown">requirements.txt + - name: Set up Python + uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: 3.9 + cache: 'pip' + - name: Install dependencies run: | pip install scons markdown sudo apt update sudo apt install gettext + - name: Add add-on version run: | import re @@ -31,16 +37,31 @@ jobs: f.write(text) f.truncate() shell: python + - name: Build add-on run: scons - name: Calculate sha256 run: sha256sum *.nvda-addon >> changelog.md + + - uses: actions/upload-artifact@v3 + with: + name: packaged_addon + path: ./*.nvda-addon + + upload_release: + runs-on: ubuntu-latest + if: ${{ startsWith(github.ref, 'refs/tags/') }} + needs: ["build"] + steps: + - uses: actions/checkout@v3 + - name: download releases files + uses: actions/download-artifact@v3 + - name: Display structure of downloaded files + run: ls -R + - name: Release uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - files: | - *.nvda-addon - body_path: changelog.md - prerelease: ${{ endsWith(github.ref, '-dev') }} + files: packaged_addon/*.nvda-addon + fail_on_unmatched_files: true + prerelease: ${{ contains(github.ref, '-') }}