diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 00000000..59323b3c --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,36 @@ +name: Std CD + +on: + push: + tags: + - "v*.*.*" + +concurrency: + group: std-cd-${{ github.workflow }}-${{ github.ref_type }} + cancel-in-progress: false + +permissions: + contents: write + packages: write + +jobs: + package: + runs-on: ubuntu-latest + steps: + - run: sudo snap install jsonschema + - uses: actions/checkout@v4 + - run: make lint + - run: make test + - run: make dist + + - run: gh config set prompt disabled + env: + GH_TOKEN: ${{ github.token }} + + - name: Perform Tag Release + run: | + gh release create ${{ github.ref_name }} --draft=false --title ${{ github.ref_name }} --target "$GITHUB_SHA" --generate-notes + gh release upload --clobber ${{ github.ref_name }} dist/*.zip dist/*.tar.gz + if: github.ref_type == 'tag' + env: + GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1ba4b40..8c9c58fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Std +name: Std CI on: schedule: diff --git a/.gitignore b/.gitignore index 68fc6918..9a8cd445 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store /build +/dist diff --git a/Makefile b/Makefile index bc3c512e..52e5b658 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,8 @@ RMRF ?= rm -rf SCHEMAS = $(shell find schemas/ -type f -name '*.json') TESTS = $(shell find test/ -type f -name '*.json') +VERSION = $(shell tr -d '\n\r' < VERSION) + all: common test $(JSONSCHEMA) fmt schemas meta --verbose $(JSONSCHEMA) fmt test --verbose --default-dialect "https://json-schema.org/draft/2020-12/schema" @@ -38,3 +40,10 @@ include generate/iso/language/include.mk include generate/iso/country/include.mk external: $(EXTERNAL) generate: $(GENERATE) + +.PHONY: dist +dist: + $(RMRF) $@ + $(MKDIRP) $@ + $(BSDTAR) -caf $@/sourcemeta-std-v$(VERSION).zip -s '|^schemas/||' --exclude '.DS_Store' schemas/* LICENSE + $(BSDTAR) -czf $@/sourcemeta-std-v$(VERSION).tar.gz -s '|^schemas/||' --exclude '.DS_Store' schemas/* LICENSE diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..8acdd82b --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0.1