diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce1e0f5..f320b31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,12 +12,12 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Install Dependencies - run: sh ./install-deps.sh - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: 20.x + - name: Install Dependencies + run: sh ./install-deps.sh - name: Install Node Modules run: make node_modules - name: Check Types diff --git a/.github/workflows/test-release-build.yml b/.github/workflows/test-release-build.yml new file mode 100644 index 0000000..403905d --- /dev/null +++ b/.github/workflows/test-release-build.yml @@ -0,0 +1,32 @@ +name: test-release-build + +on: + push: + branches: + - master + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: 20.x + - name: Install Dependencies + run: sh ./install-deps.sh + - name: Make a Temporary Version Number (if needed) + run: | + if [ -z "$(git tag --points-at=HEAD)" ]; then + node -e "x=`cat assets/manifest.json`; x.version='9999.99.9999'; console.log(JSON.stringify(x))" >assets/manifest.json.new + mv assets/manifest.json.new assets/manifest.json + make fix-style + git config --global user.name "GitHub Actions" + git config --global user.email "nobody@example.com" + git commit -m 'Make a temporary version number' assets/manifest.json + fi + - name: Try Building Release Artifacts + run: make rel diff --git a/Makefile b/Makefile index b0ac7b5..e674595 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,13 @@ rel: rel-inner: $(MAKE) pkg-webext pkg-source $(MAKE) -C $(RELEASE_DIR)/$(SRCPKG_DIR) release-tag pkg-webext pkg-source - [ -z "$$(diff -Nru dist $(RELEASE_DIR)/$(SRCPKG_DIR)/dist)" ] + @if [ ! -z "$$(diff -Nru dist $(RELEASE_DIR)/$(SRCPKG_DIR)/dist)" ]; then \ + diff -Nru dist $(RELEASE_DIR)/$(SRCPKG_DIR)/dist; \ + echo "!!!" >&2; \ + echo "!!! Build did not reproduce correctly; check diff output above" >&2; \ + echo "!!!" >&2; \ + exit 1; \ + fi rm -rf $(RELEASE_DIR)/$(SRCPKG_DIR) @echo "" @echo "Ready for release $(VERSION)!" @@ -198,8 +204,9 @@ site: ## Cleanup distclean: clean - rm -rf node_modules $(RELEASE_DIR)/$(SRCPKG_DIR) $(SRC_PKG) $(DIST_PKG) - rm -rf docs/vendor + rm -rf node_modules docs/vendor \ + $(RELEASE_DIR)/$(SRCPKG_DIR) $(SRC_PKG) $(DIST_PKG) \ + releases/*-dirty* releases/*-dev* .PHONY: distclean clean: diff --git a/install-deps.sh b/install-deps.sh index 6069430..a0c3836 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -44,6 +44,9 @@ deps_apt() { sudo apt-get update sudo apt-get install -y nodejs + + elif [ "$(node --version |cut -c2-3)" -lt $NODE_VERSION ]; then + die "Please upgrade Node.js to v$NODE_VERSION or later (you have $(node --version))." fi }