change upload name & overwrite #13
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: Build and Release | |
on: | |
push | |
# on: | |
# release: | |
# types: [published] | |
jobs: | |
build: | |
name: Build Code | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Install Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- 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 inderect dep 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 | |
- name: create artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tree-sitter-sql-${{ matrix.arch }} | |
path: tree-sitter-sql-${{ matrix.arch }}.zip | |
retention-days: 1 | |
overwrite: true | |
publish: | |
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 == 'push' | |
run: | | |
TAG_NAME=${{ github.ref }} | |
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV | |
# - name: Generate SHA256 checksums | |
# run: | | |
# sha256sum tree-sitter-sql.zip > tree-sitter-sql-.tar.gz.sha256sum | |
# echo "SHA_LINUX_64_TAR=$(cat tree-sitter-sql-tar.gz.sha256sum)" >> $GITHUB_ENV | |
- name: Publish release | |
env: | |
RELEASE_TAG: v0.0.1 | |
run: | | |
gh release create stable $RELEASE_TAG --target $GITHUB_SHA tree-sitter-sql-*.zip |