diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9d24711 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Package release + +on: + push: + tags: + - "v*.*.*" + +permissions: + contents: write + +jobs: + release: + name: Test, package, and draft release + runs-on: ubuntu-latest + + steps: + - name: Check out tagged commit + uses: actions/checkout@v6 + + - name: Install Lua 5.1.5 + uses: leafo/gh-actions-lua@v13 + with: + luaVersion: "5.1.5" + + - name: Install LuaRocks + uses: leafo/gh-actions-luarocks@v6 + + - name: Install Busted + run: luarocks install busted 2.3.0-1 + + - name: Derive version from tag + shell: bash + run: | + VERSION="${GITHUB_REF_NAME#v}" + echo "VERSION=$VERSION" >> "$GITHUB_ENV" + echo "PACKAGE=dist/lightroom-llama-v${VERSION}.zip" >> "$GITHUB_ENV" + + - name: Build release package + run: make package VERSION="$VERSION" + + - name: Create draft GitHub release + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release create "$GITHUB_REF_NAME" "$PACKAGE" \ + --verify-tag \ + --draft \ + --generate-notes \ + --title "Lightroom Llama $VERSION" diff --git a/.gitignore b/.gitignore index 80c1a2e..703a98a 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,7 @@ luac.out *.x86_64 *.hex -reference.lrplugin \ No newline at end of file +reference.lrplugin + +# Generated release packages +dist/ \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..30cf57e --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/lightroom-llama.iml b/.idea/lightroom-llama.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/lightroom-llama.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Makefile b/Makefile index 2b83a11..8c77b86 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,26 @@ -.PHONY: test clean +VERSION ?= dev +DIST_DIR := dist +PLUGIN_DIR := lightroom-llama.lrplugin +PACKAGE := $(DIST_DIR)/lightroom-llama-v$(VERSION).zip + +.PHONY: test clean package # Run the Busted unit test suite for plugin modules. -# Delegates to run_tests.sh (the authoritative runner) so flags are only defined once. +# Delegates to run_tests.sh so test flags are defined in one place. test: ./tests/run_tests.sh -# Remove generated/test artifacts +# Run tests, create the release ZIP, and verify that the archive is valid. +package: test + rm -rf "$(DIST_DIR)" + mkdir -p "$(DIST_DIR)" + zip -r "$(PACKAGE)" "$(PLUGIN_DIR)" \ + -x "*/.DS_Store" \ + "*/__MACOSX/*" \ + "*/._*" + unzip -t "$(PACKAGE)" + +# Remove generated test and release artifacts. clean: rm -f tests/spec/*.gc* 2>/dev/null || true + rm -rf "$(DIST_DIR)" \ No newline at end of file