-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor for z7 * update gitignore * build workflow * more refactoring (delete files) * add tests * revise and extend review * add version to changelog * bump version to 0.2.11 * Update updates.json and update.rdf * minor change in changelog * Update updates.json and update.rdf * also change version in install.rdf for z6 version * version in install.rdf * delete comments * Update updates.json and update.rdf * change pr request mechanism
- Loading branch information
1 parent
2d6777c
commit e3e653f
Showing
46 changed files
with
2,957 additions
and
49 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
BASE_NAME="zotero-swisscovery-ubbern-locations" | ||
REPO_OWNER="ub-unibe-ch" | ||
REPO_NAME="zotero-swissbib-bb-locations" | ||
PLUGIN_ID="[email protected]" | ||
MANIFEST_JSON="src/manifest.json" | ||
INSTALL_RDF="src/install.rdf" | ||
UPDATE_TEMPLATE_FILE="updates.template.json" | ||
UPDATE_JSON_FILE="updates.json" | ||
UPDATE_RDF_FILE="update.rdf" | ||
BUILD_DIR="build" | ||
CHANGELOG="CHANGES.md" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Create Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
paths: | ||
- 'src/manifest.json' | ||
|
||
workflow_dispatch: # allows to manually trigger the workflow_dispatch | ||
|
||
jobs: | ||
create-release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt install jq | ||
- name: Set up Git user | ||
run: | | ||
git config --global user.name 'github-actions' | ||
git config --global user.email '[email protected]' | ||
- name: Load .env file | ||
run: | | ||
set -o allexport | ||
source .env | ||
set +o allexport | ||
# Export all loaded variables to GITHUB_ENV | ||
for var in $(cat .env | grep -v '^#' | xargs); do | ||
echo "$var" >> $GITHUB_ENV | ||
done | ||
- name: Extract version number | ||
id: extract_version | ||
run: echo "VERSION=$(jq -r '.version' src/manifest.json)" >> $GITHUB_ENV | ||
|
||
- name: Check changelog for version entry | ||
run: | | ||
if ! grep -q "## v${VERSION}" "${CHANGELOG}"; then | ||
echo "Error: ${CHANGELOG} does not contain a heading for version v${VERSION}." | ||
exit 1 | ||
fi | ||
- name: Build release | ||
run: | | ||
echo "Building release ${BASE_NAME}-$VERSION" | ||
scripts/build.sh ${BASE_NAME} $VERSION | ||
echo "Built release ${BASE_NAME}-$VERSION" | ||
- name: Get release notes | ||
run: | | ||
echo "Extract release notes from ${CHANGELOG}" | ||
echo "## Changes" >> release-notes-${VERSION}.md | ||
sed -n "/## v${VERSION}/,/^## /p" ${CHANGELOG} | sed '1d;$d' >> release-notes-${VERSION}.md | ||
echo "Extracted release notes from ${CHANGELOG}" | ||
- name: Create release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
echo "Creating release $VERSION" | ||
gh release create v${VERSION} ${BUILD_DIR}/${BASE_NAME}-${VERSION}.xpi -t "v${VERSION}" --notes-file release-notes-${VERSION}.md | ||
echo "Created release $VERSION" | ||
- name: Cleanup | ||
run: | | ||
rm release-notes-${VERSION}.md | ||
rm -rf ${BUILD_DIR} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
build/ | ||
.project | ||
*.xpi | ||
*.xpi | ||
node_modules/ |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,62 @@ | ||
# Makefile | ||
|
||
VERSION = 0.2.10 | ||
.PHONY: all check-tools version phony update-files pr clean | ||
|
||
build: | ||
7z a -tzip -r zotero-swisscovery-ubbern-locations-$(VERSION).xpi chrome/* defaults/* chrome.manifest install.rdf options.xul | ||
# Helper to source .env and get variables | ||
GET_VAR = ./scripts/get_env_var.sh | ||
|
||
# Define variables by sourcing .env | ||
BASE_NAME := $(shell $(GET_VAR) BASE_NAME) | ||
BUILD_DIR := $(shell $(GET_VAR) BUILD_DIR) | ||
MANIFEST_JSON= $(shell $(GET_VAR) MANIFEST_JSON) | ||
UPDATE_JSON_FILE := $(shell $(GET_VAR) UPDATE_JSON_FILE) | ||
UPDATE_RDF_FILE := $(shell $(GET_VAR) UPDATE_RDF_FILE) | ||
|
||
# Function to get version from manifest.json | ||
define get_version | ||
$(shell jq -r '.version' src/manifest.json) | ||
endef | ||
|
||
# Get initial version | ||
VERSION := $(call get_version) | ||
XPI_FILE := $(BUILD_DIR)/$(BASE_NAME)-$(VERSION).xpi | ||
|
||
# Export environment variables to make them available in scripts | ||
export XPI_FILE | ||
export VERSION | ||
|
||
######################### | ||
# Build targets | ||
######################### | ||
|
||
# Default Target | ||
.DEFAULT_GOAL := all | ||
|
||
# Define dependencies | ||
all: pr | ||
|
||
pr: update-files | ||
./scripts/manage_pr.sh | ||
|
||
update-files: build | ||
./scripts/update_files.sh | ||
cp $(UPDATE_JSON_FILE) $(UPDATE_RDF_FILE) | ||
|
||
build: $(BUILD_DIR)/$(BASE_NAME)-$(call get_version).xpi | ||
|
||
# Build target, depends on manifest.json and source files | ||
$(BUILD_DIR)/$(BASE_NAME)-$(call get_version).xpi: $(wildcard src/*) $(MANIFEST_JSON) | ||
./scripts/build.sh $(BASE_NAME) $(call get_version) | ||
|
||
version: $(MANIFEST_JSON) | ||
|
||
$(MANIFEST_JSON): check-tools | ||
./scripts/manage_version.sh | ||
$(eval VERSION := $(call get_version)) | ||
$(eval export VERSION) | ||
|
||
check-tools: | ||
./scripts/check_tools.sh | ||
|
||
clean: | ||
rm -f $(BUILD_DIR)/*.xpi |
Oops, something went wrong.