Skip to content

Commit

Permalink
try tagged release trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-Q committed Apr 21, 2024
1 parent 02e73e7 commit a7ae4e6
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 99 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@


name: Create Release

on:
push:
branch:
- gh_release_build_experimenting
tags:
- release_test

build:
name: Build Code
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
include:
- arch: x86_64
os: ubuntu-latest
- arch: macos_arm64
os: macos-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 20

# We need emscripten to build the wasm file
- name: Install Emscripten
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y emscripten
- name: Install Emscripten
if: matrix.os == 'macos-latest'
run: |
brew install emscripten
- name: Build Code
run: |
npm install nan # why? it is a indirect dependency already, yet it cannot be found
npm install
npm run build
zip -r tree-sitter-sql-${{ matrix.arch }}.zip src sql.so tree-sitter-sql.wasm # TODO: add version name
tar -czvf tree-sitter-sql-${{ matrix.arch }}.tar.gz src sql.so grammar.js tree-sitter-sql.wasm # TODO: add version name
- name: upload zip
uses: actions/upload-artifact@v4
with:
name: tree-sitter-sql-${{ matrix.arch }}
path: tree-sitter-sql-${{ matrix.arch }}.*
retention-days: 1
overwrite: true

publish_artifacts:
needs: [build]
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4

- if: github.event_name == 'release'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- name: Generate Linux Zip SHA256 checksums
run: |
cd tree-sitter-sql-x86_64
sha256sum tree-sitter-sql-x86_64.zip > tree-sitter-sql-x86_64.zip.sha256sum
echo "SHA_LINUX_64_ZIP=$(cat tree-sitter-sql-x86_64.zip.sha256sum)" >> $GITHUB_ENV
- name: Generate Linux Tar SHA256 checksums
run: |
cd tree-sitter-sql-x86_64
sha256sum tree-sitter-sql-x86_64.tar.gz > tree-sitter-sql-x86_64.tar.gz.sha256sum
echo "SHA_LINUX_64_TAR=$(cat tree-sitter-sql-x86_64.tar.gz.sha256sum)" >> $GITHUB_ENV
- name: Generate MacOS Zip SHA256 checksums
run: |
cd tree-sitter-sql-macos_arm64
sha256sum tree-sitter-sql-macos_arm64.zip > tree-sitter-sql-macos_arm64.zip.sha256sum
echo "SHA_MACOS_ARM64_ZIP=$(cat tree-sitter-sql-macos_arm64.zip.sha256sum)" >> $GITHUB_ENV
- name: Generate MacOS Tar SHA256 checksums
run: |
cd tree-sitter-sql-macos_arm64
sha256sum tree-sitter-sql-macos_arm64.tar.gz > tree-sitter-sql-macos_arm64.tar.gz.sha256sum
echo "SHA_MACOS_ARM64_TAR=$(cat tree-sitter-sql-macos_arm64.tar.gz.sha256sum)" >> $GITHUB_ENV
- name: Publish release
run: |
echo $GITHUB_ENV
echo $(git describe --tags --abbrev=0)
envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md"
gh release create $(git describe --tags --abbrev=0) --notes-file "$RUNNER_TEMP/notes.md" --target $GITHUB_SHA tree-sitter-sql-x86_64/tree-sitter-sql-x86_64.* tree-sitter-sql-macos_arm64/tree-sitter-sql-macos_arm64.*
100 changes: 1 addition & 99 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
types: [published]

jobs:
publish:
publish_npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -16,101 +16,3 @@ jobs:
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

build:
name: Build Code
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
include:
- arch: x86_64
os: ubuntu-latest
- arch: macos_arm64
os: macos-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 20

# We need emscripten to build the wasm file
- name: Install Emscripten
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y emscripten
- name: Install Emscripten
if: matrix.os == 'macos-latest'
run: |
brew install emscripten
- name: Build Code
run: |
npm install nan # why? it is a indirect dependency already, yet it cannot be found
npm install
npm run build
zip -r tree-sitter-sql-${{ matrix.arch }}.zip src sql.so tree-sitter-sql.wasm # TODO: add version name
tar -czvf tree-sitter-sql-${{ matrix.arch }}.tar.gz src sql.so grammar.js tree-sitter-sql.wasm # TODO: add version name
- name: upload zip
uses: actions/upload-artifact@v4
with:
name: tree-sitter-sql-${{ matrix.arch }}
path: tree-sitter-sql-${{ matrix.arch }}.*
retention-days: 1
overwrite: true

publish_artifacts:
needs: [build]
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4

- if: github.event_name == 'release'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- name: Generate Linux Zip SHA256 checksums
run: |
cd tree-sitter-sql-x86_64
sha256sum tree-sitter-sql-x86_64.zip > tree-sitter-sql-x86_64.zip.sha256sum
echo "SHA_LINUX_64_ZIP=$(cat tree-sitter-sql-x86_64.zip.sha256sum)" >> $GITHUB_ENV
- name: Generate Linux Tar SHA256 checksums
run: |
cd tree-sitter-sql-x86_64
sha256sum tree-sitter-sql-x86_64.tar.gz > tree-sitter-sql-x86_64.tar.gz.sha256sum
echo "SHA_LINUX_64_TAR=$(cat tree-sitter-sql-x86_64.tar.gz.sha256sum)" >> $GITHUB_ENV
- name: Generate MacOS Zip SHA256 checksums
run: |
cd tree-sitter-sql-macos_arm64
sha256sum tree-sitter-sql-macos_arm64.zip > tree-sitter-sql-macos_arm64.zip.sha256sum
echo "SHA_MACOS_ARM64_ZIP=$(cat tree-sitter-sql-macos_arm64.zip.sha256sum)" >> $GITHUB_ENV
- name: Generate MacOS Tar SHA256 checksums
run: |
cd tree-sitter-sql-macos_arm64
sha256sum tree-sitter-sql-macos_arm64.tar.gz > tree-sitter-sql-macos_arm64.tar.gz.sha256sum
echo "SHA_MACOS_ARM64_TAR=$(cat tree-sitter-sql-macos_arm64.tar.gz.sha256sum)" >> $GITHUB_ENV
- name: Publish release
run: |
echo $GITHUB_ENV
echo $(git describe --tags --abbrev=0)
envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md"
gh release create $(git describe --tags --abbrev=0) --notes-file "$RUNNER_TEMP/notes.md" --target $GITHUB_SHA tree-sitter-sql-x86_64/tree-sitter-sql-x86_64.* tree-sitter-sql-macos_arm64/tree-sitter-sql-macos_arm64.*

0 comments on commit a7ae4e6

Please sign in to comment.