Release 0.12.222 #245
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- '*.*.*' | |
# These are used to trigger (only) MELPA Stable. See | |
# https://github.com/emacs-tree-sitter/elisp-tree-sitter/issues/177 | |
- '!melpa-stable/**' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# TODO: Get host platform from somewher instead of specifying it explicitly here. | |
- os: macos-12 | |
bundle_os: macos | |
emacs-version: '27.2' | |
ext: dylib | |
host: x86_64-apple-darwin | |
- os: macos-12 | |
bundle_os: macos | |
emacs-version: '27.2' | |
ext: dylib | |
target: aarch64-apple-darwin | |
- os: ubuntu-20.04 | |
bundle_os: linux | |
emacs-version: '27.2' | |
ext: so | |
host: x86_64-unknown-linux-gnu | |
- os: windows-2019 | |
bundle_os: windows | |
emacs-version: '27.2' | |
ext: dll | |
host: x86_64-pc-windows-msvc | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: .github/script/setup | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install tree-sitter CLI | |
run: npm install -g [email protected] | |
- uses: jcs090218/setup-emacs@master | |
with: | |
version: ${{ matrix.emacs-version }} | |
- uses: emacs-eask/setup-eask@master | |
with: | |
version: 'snapshot' | |
- run: eask install-deps | |
- run: script/compile all -target "${{ matrix.target }}" | |
continue-on-error: ${{ !matrix.target }} | |
- run: script/inspect-binaries | |
continue-on-error: true | |
- run: script/test | |
if: ${{ !matrix.target }} | |
continue-on-error: ${{ runner.os == 'Windows' }} | |
- run: eask package | |
if: ${{ !matrix.target }} | |
- name: Determine version | |
if: runner.os != 'Windows' | |
run: | | |
bundle_version=$(script/bundle-version) | |
bundle_version=${bundle_version//$'\n'/} | |
echo BUNDLE_VERSION=$bundle_version >> $GITHUB_ENV | |
- name: Determine version | |
if: runner.os == 'Windows' | |
run: | | |
$bundle_version = ((script/bundle-version) | Out-String).Trim() | |
echo BUNDLE_VERSION=$bundle_version | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Rename cross-compilation's binary | |
if: matrix.target | |
run: | | |
mv tree-sitter-grammars-${{ matrix.bundle_os }}-${{ env.BUNDLE_VERSION }}.tar.gz tree-sitter-grammars.${{ matrix.target }}.v${{ env.BUNDLE_VERSION }}.tar.gz | |
- name: Make a target-explicit copy of native compilation's binary | |
if: ${{ !matrix.target && matrix.host }} | |
shell: bash | |
run: | | |
cp tree-sitter-grammars-${{ matrix.bundle_os }}-${{ env.BUNDLE_VERSION }}.tar.gz tree-sitter-grammars.${{ matrix.host }}.v${{ env.BUNDLE_VERSION }}.tar.gz | |
- name: Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tree-sitter-grammars | |
path: tree-sitter-grammars*.tar.gz | |
if-no-files-found: error | |
publish: | |
needs: build | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: jcs090218/setup-emacs@master | |
with: | |
version: '27.2' | |
- uses: actions/checkout@v4 | |
- name: Generate release notes | |
run: | | |
RELEASE_VERSION=$(git describe --tags --abbrev=0) | |
script/dev release-notes "$RELEASE_VERSION" > RELEASE-NOTES | |
echo RELEASE_VERSION=$RELEASE_VERSION >> $GITHUB_ENV | |
cat RELEASE-NOTES | |
- name: Download binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: tree-sitter-grammars | |
- run: ls -R | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: RELEASE-NOTES | |
files: | | |
tree-sitter-grammars*.tar.gz | |
- name: Greenlight releasing to MELPA | |
uses: actions/github-script@v5 | |
with: | |
github-token: ${{ secrets.PAT }} | |
script: | | |
github.rest.git.updateRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "heads/release", | |
sha: context.sha | |
}) | |
continue-on-error: true | |
- name: Greenlight releasing to MELPA Stable | |
uses: actions/github-script@v5 | |
with: | |
github-token: ${{ secrets.PAT }} | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "refs/tags/melpa-stable/v${{ env.RELEASE_VERSION }}", | |
sha: context.sha | |
}) | |
continue-on-error: true |