|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '*.*.*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + strategy: |
| 11 | + fail-fast: true |
| 12 | + matrix: |
| 13 | + include: |
| 14 | + - os: macos-10.15 |
| 15 | + bundle_target: macos |
| 16 | + emacs-version: '27.2' |
| 17 | + ext: dylib |
| 18 | + - os: ubuntu-18.04 |
| 19 | + bundle_target: linux |
| 20 | + emacs-version: '27.2' |
| 21 | + ext: so |
| 22 | + - os: windows-2019 |
| 23 | + bundle_target: windows |
| 24 | + emacs-version: '27.2' |
| 25 | + ext: dll |
| 26 | + runs-on: ${{ matrix.os }} |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v2 |
| 29 | + - run: .github/script/setup |
| 30 | + |
| 31 | + - name: Install tree-sitter CLI |
| 32 | + run: npm install -g tree-sitter-cli@0.19.3 |
| 33 | + |
| 34 | + - uses: purcell/setup-emacs@v3.0 |
| 35 | + if: runner.os != 'Windows' |
| 36 | + with: |
| 37 | + version: ${{ matrix.emacs-version }} |
| 38 | + - uses: jcs090218/setup-emacs-windows@v4 |
| 39 | + if: runner.os == 'Windows' |
| 40 | + with: |
| 41 | + version: ${{ matrix.emacs-version }} |
| 42 | + |
| 43 | + - run: .github/script/setup-cask |
| 44 | + - run: cask install |
| 45 | + |
| 46 | + - run: script/compile all |
| 47 | + continue-on-error: true |
| 48 | + |
| 49 | + - run: script/inspect-binaries |
| 50 | + continue-on-error: true |
| 51 | + - run: script/test |
| 52 | + - run: cask package |
| 53 | + |
| 54 | + - name: Determine version |
| 55 | + if: runner.os != 'Windows' |
| 56 | + run: | |
| 57 | + echo BUNDLE_VERSION=$(script/version) > $GITHUB_ENV |
| 58 | + - name: Determine version |
| 59 | + if: runner.os == 'Windows' |
| 60 | + run: | |
| 61 | + $bundle_version = ((script/version) | Out-String).Trim() |
| 62 | + echo BUNDLE_VERSION=$bundle_version | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append |
| 63 | +
|
| 64 | + - name: Upload binary |
| 65 | + uses: actions/upload-artifact@v2 |
| 66 | + with: |
| 67 | + name: tree-sitter-grammars |
| 68 | + path: tree-sitter-grammars-${{ matrix.bundle_target }}-${{ env.BUNDLE_VERSION }}.tar.gz |
| 69 | + if-no-files-found: error |
| 70 | + |
| 71 | + publish: |
| 72 | + needs: build |
| 73 | + runs-on: ubuntu-18.04 |
| 74 | + steps: |
| 75 | + - uses: purcell/setup-emacs@v3.0 |
| 76 | + with: |
| 77 | + version: '27.2' |
| 78 | + - uses: actions/checkout@v2 |
| 79 | + - name: Generate release notes |
| 80 | + run: | |
| 81 | + script/release-notes > RELEASE-NOTES |
| 82 | + cat RELEASE-NOTES |
| 83 | +
|
| 84 | + - name: Download binaries |
| 85 | + uses: actions/download-artifact@v2 |
| 86 | + with: |
| 87 | + name: tree-sitter-grammars |
| 88 | + - run: ls -R |
| 89 | + |
| 90 | + - name: Create GitHub Release |
| 91 | + uses: softprops/action-gh-release@v1 |
| 92 | + with: |
| 93 | + draft: true |
| 94 | + body_path: RELEASE-NOTES |
| 95 | + files: | |
| 96 | + tree-sitter-grammars-*.tar.gz |
0 commit comments