Skip to content

Commit f5b8c9d

Browse files
committed
ci: Switch release pipeline from Azure Pipelines to GitHub Actions
1 parent 3d89a7c commit f5b8c9d

File tree

7 files changed

+119
-93
lines changed

7 files changed

+119
-93
lines changed

.azure-pipelines/release.yml

Lines changed: 0 additions & 64 deletions
This file was deleted.

.azure-pipelines/steps/grammar-bundle/-load.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

.azure-pipelines/steps/grammar-bundle/-save.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.azure-pipelines/steps/grammar-bundle/-upload.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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

script/dev.el

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(defun :release-notes (version &optional changelog-path)
2+
(with-temp-buffer
3+
(insert-file-contents (or changelog-path "CHANGELOG.md"))
4+
(re-search-forward (format "## .*%s.*" version))
5+
(forward-line)
6+
(beginning-of-line)
7+
(let ((start (point)))
8+
(re-search-forward "^##")
9+
(buffer-substring-no-properties start (1- (match-beginning 0))))))

script/release-notes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# Print the release notes of a specific version. If a version is not explicitly specified, use the
3+
# latest annotated tag.
4+
5+
set -euo pipefail
6+
7+
here=$(cd "$(dirname "$BASH_SOURCE")"; pwd)
8+
PROJECT_ROOT=$(cd "$here/.."; pwd)
9+
10+
(
11+
cd "$PROJECT_ROOT"
12+
version=${1:-$(git describe --tags --abbrev=0)}
13+
emacs --batch --load script/dev.el --eval "(princ (:release-notes \"$version\"))"
14+
)

0 commit comments

Comments
 (0)