diff --git a/.github/settings.xml b/.github/settings.xml new file mode 100644 index 000000000..421c73ae8 --- /dev/null +++ b/.github/settings.xml @@ -0,0 +1,26 @@ + + + + central + ${env.SONATYPE_USERNAME} + ${env.SONATYPE_PASSWORD} + + + + + + central + + true + + + gpg + ${env.GPG_KEY_ID} + ${env.GPG_PASSPHRASE} + true + + + + diff --git a/.github/workflows/build-matrix.yml b/.github/workflows/build-matrix.yml index 00f463866..b17bf6723 100644 --- a/.github/workflows/build-matrix.yml +++ b/.github/workflows/build-matrix.yml @@ -8,19 +8,23 @@ jobs: strategy: fail-fast: false matrix: - java_version: [1.8, 11, 15, 17] + java_version: [11, 17] os: [ubuntu-latest, windows-latest, macOS-latest] steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + with: + fetch-depth: 0 # Important for versioning extension to work correctly - name: Mustache Specs run: | git submodule update --init --recursive - name: Set up JDK ${{ matrix.java_version }} - uses: actions/setup-java@v1 + uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 with: java-version: ${{ matrix.java_version }} + distribution: "temurin" + cache: maven - name: Install run: mvn clean install -DskipTests --batch-mode --no-transfer-progress env: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..016da757a --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,151 @@ +name: "CodeQL Advanced" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + + +jobs: + analyze-java: + name: Analyze Java + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: java + build-mode: manual # This mode only analyzes Java. Set this to 'autobuild' or 'manual' to analyze Kotlin too. + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: '0' + + # Add any setup steps before running the `github/codeql-action/init` action. + # This includes steps like installing compilers or runtimes (`actions/setup-node` + # or others). This is typically only required for manual builds. + # - name: Setup runtime (example) + # uses: actions/setup-example@v1 + + # Initializes the CodeQL tools for scanning. + + + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: java + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + queries: security-extended,security-and-quality + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: '11' # Specify the JDK version your project needs + distribution: 'temurin' + cache: maven + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + mvn -B clean install -DskipTests + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" + + + analyze-js: + name: Analyze Javascript + runs-on: ubuntu-latest + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: javascript-typescript + build-mode: none + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Add any setup steps before running the `github/codeql-action/init` action. + # This includes steps like installing compilers or runtimes (`actions/setup-node` + # or others). This is typically only required for manual builds. + # - name: Setup runtime (example) + # uses: actions/setup-example@v1 + + # Initializes the CodeQL tools for scanning. + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..6f799e0be --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,66 @@ +name: Release + +on: + push: + branches: + - main + - master + tags: + - "v*" + workflow_dispatch: + +jobs: + publish: + name: Publish + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + with: + fetch-depth: 0 # Important for versioning extension to work correctly + + - name: Set up JDK 11 + uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 + with: + java-version: 11 + distribution: "temurin" + cache: maven + + - name: Install GPG key + run: | + echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode | gpg --batch --import + gpg --list-secret-keys --keyid-format LONG + + - name: Set release type + id: release_type + run: | + echo "GitHub ref: $GITHUB_REF" + if [[ $GITHUB_REF == refs/tags/v* ]]; then + echo "IS_RELEASE=true" >> $GITHUB_ENV + echo "This is a release build from tag ${GITHUB_REF#refs/tags/}" + else + echo "IS_RELEASE=false" >> $GITHUB_ENV + echo "This is a snapshot build from branch ${GITHUB_REF#refs/heads/}" + fi + + - name: Build code + run: mvn clean verify -DskipTests + + - name: Deploy to Maven Central + run: | + if [[ $IS_RELEASE == true ]]; then + echo "Deploying release to Maven Central" + mvn deploy -P sonatype -DskipTests \ + -s ${{ github.workspace }}/.github/settings.xml + else + echo "Deploying snapshot to Maven Central" + mvn deploy -DskipTests \ + -s ${{ github.workspace }}/.github/settings.xml + fi + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + VERSIONING_EXTENSION_LOG: true diff --git a/.gitignore b/.gitignore index 2970e1308..d9ee96da6 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,8 @@ pom.xml.versionsBackup jacoco.exec out + +# VSCode +.vscode + +.git-versioned-pom.xml diff --git a/.java-version b/.java-version new file mode 100644 index 000000000..b4de39476 --- /dev/null +++ b/.java-version @@ -0,0 +1 @@ +11 diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml new file mode 100644 index 000000000..f49fe9821 --- /dev/null +++ b/.mvn/extensions.xml @@ -0,0 +1,8 @@ + + + + me.qoomon + maven-git-versioning-extension + 9.10.2 + + diff --git a/.mvn/maven-git-versioning-extension.xml b/.mvn/maven-git-versioning-extension.xml new file mode 100644 index 000000000..9e3497252 --- /dev/null +++ b/.mvn/maven-git-versioning-extension.xml @@ -0,0 +1,22 @@ + + + + + .*)]]> + ${ref.version} + + + .+ + ${describe.tag.version}+${describe.distance}-${commit.short}-SNAPSHOT + + + + true + + + + ${commit} + + diff --git a/README.md b/README.md index 80c4069ce..7d5cfd90b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Become a Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://patreon.com/edgarespina) -[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.jknack/handlebars/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.jknack/handlebars) -[![javadoc](https://javadoc.io/badge/com.github.jknack/handlebars.svg)](https://javadoc.io/doc/com.github.jknack/handlebars) +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.iterable/handlebars/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.iterable/handlebars) +[![javadoc](https://javadoc.io/badge/com.iterable/handlebars.svg)](https://javadoc.io/doc/com.iterable/handlebars) Handlebars.java =============== @@ -33,15 +33,15 @@ Handlebars provides the power necessary to let you build semantic templates effe # Getting Started In general, the syntax of **Handlebars** templates is a superset of [Mustache](https://mustache.github.io) templates. For basic syntax, check out the [Mustache manpage](https://mustache.github.io). - The [Handlebars.java blog](https://jknack.github.io/handlebars.java) is a good place for getting started too. Javadoc is available at [javadoc.io](https://javadoc.io/doc/com.github.jknack/handlebars). + The [Handlebars.java blog](https://jknack.github.io/handlebars.java) is a good place for getting started too. Javadoc is available at [javadoc.io](https://javadoc.io/doc/com.iterable/handlebars). ## Maven -#### Stable version: [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.jknack/handlebars/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.jknack/handlebars) +#### Stable version: [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.iterable/handlebars/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.iterable/handlebars) ```xml - com.github.jknack + com.iterable handlebars ${handlebars-version} @@ -51,7 +51,7 @@ Handlebars provides the power necessary to let you build semantic templates effe Templates are loaded using the ```TemplateLoader``` class. Handlebars.java provides three implementations of a ```TemplateLoader```: * ClassPathTemplateLoader (default) * FileTemplateLoader - * SpringTemplateLoader (see the [handlebars-springmvc](https://github.com/jknack/handlebars.java/tree/master/handlebars-springmvc) module) + * SpringTemplateLoader (see the [handlebars-springmvc](https://github.com/iterable/handlebars.java/tree/master/handlebars-springmvc) module) This example loads ```mytemplate.hbs``` from the root of the classpath: @@ -112,7 +112,7 @@ Download from Maven Central: Maven: ```xml - com.github.jknack + com.iterable handlebars-proto ${current-version} @@ -274,7 +274,7 @@ context: A template name. Required. wrapper: One of "anonymous", "amd" or "none". Default is: "anonymous" -There is a [maven plugin](https://github.com/jknack/handlebars.java/tree/master/handlebars-maven-plugin) available too. +There is a [maven plugin](https://github.com/iterable/handlebars.java/tree/master/handlebars-maven-plugin) available too. ### embedded The embedded helper allow you to "embedded" a handlebars template inside a ```