Skip to content

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Florents-Tselai committed Mar 4, 2024
1 parent 5bfc68c commit 1822a1e
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 5 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: publish

on:
push:
tags:
- "*"
workflow_dispatch:

env:
SQLITE_RELEASE_YEAR: "2021"
SQLITE_VERSION: "3360000"
SQLITE_BRANCH: "3.36"

jobs:
publish:
name: Publish for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
- os: macos-latest

steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt update
sudo apt install -y build-essential \
pkg-config \
autoconf \
libtool \
wget \
sqlite3 libsqlite3-dev libjq-dev
- name: make all
shell: bash
run: |
make all
- name: make dist
run: |
make dist
- name: Upload binaries to release
uses: actions/upload-artifact@v4
with:
path: |
dist/*.zip
30 changes: 25 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
CC=gcc
UNAME_S=$(shell uname -s)
UNAME_M=$(shell uname -m)
LITEJQ_VERSION:=$(shell git tag --points-at HEAD)

ifeq (Darwin,$(UNAME_S))
CFLAGS:=-Wall -Wsign-compare -fPIC -dynamiclib -DLITEJQ_VERSION=$(LITEJQ_VERSION)
else ifeq (Linux,$(UNAME_S))
CFLAGS=-z now -z relro -Wall -Wsign-compare -Wno-unknown-pragmas -fPIC -shared -DLITEJQ_VERSION=$(LITEJQ_VERSION)
else
CFLAGS=-shared -fPIC
endif

SRC=litejq.c
OUT=litejq
PKG_CONFIG ?= pkg-config
Expand All @@ -26,11 +37,20 @@ run-test-%:

test: run-test-basic run-test-complex

clean:
-rm -f $(OUT)
-rm tests/output/*.sql

dev: clean all test

.PHONY: dev
.default: all
.default: all dist

DIST_ZIP=./dist/litejq-$(LITEJQ_VERSION)-$(UNAME_S)-$(UNAME_M).zip

$(DIST_ZIP): $(OUT)
mkdir -p dist
zip -p $@ $^

dist: $(DIST_ZIP)

clean:
-rm -f $(OUT)
-rm tests/output/*.sql
-rm -rf dist/

0 comments on commit 1822a1e

Please sign in to comment.