Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Commit

Permalink
Prepeare for release to Central Repository (#102)
Browse files Browse the repository at this point in the history
* Switch to GitHub Actions CI
* Remove CircleCI config
* Add GitHub Actions workflow for Maven build
* Run Angular tests using Puppeteer to avoid CI issues
* Prepare for release to Central Repository
* Update and simplify instructions in README
* Use deployment profile
  • Loading branch information
samuelmeuli authored and grubyak committed Oct 10, 2019
1 parent 2d6e980 commit 82e3a6b
Show file tree
Hide file tree
Showing 12 changed files with 437 additions and 189 deletions.
42 changes: 0 additions & 42 deletions .circleci/config.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" ?>

<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2019 Adobe Incorporated
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->

<!-- Maven settings for CI -->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<!-- GPG settings -->
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
</profiles>

<servers>
<!-- Sonatype credentials -->
<server>
<id>ossrh</id>
<username>${env.SONATYPE_USERNAME}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
</servers>
</settings>
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2019 Adobe Systems Incorporated
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

name: Release

# Run workflow on commits to default branch
on:
push:
branches:
- development

jobs:
release:
runs-on: ubuntu-18.04
steps:
# Check out Git repository
- uses: actions/checkout@v1

# Set up environment with Java and Maven
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 11

# Import GPG key from env variable into keychain
- name: Import GPG key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
run: echo ${GPG_PRIVATE_KEY} | base64 --decode | gpg --batch --import

# Deploy to OSSRH, which will automatically release to Central Repository
- name: Release to Central Repository
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: mvn clean deploy -Pdeploy -s ./.github/settings.xml
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2019 Adobe Systems Incorporated
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

name: Test

# Run workflow on commits to all branches
on: push

jobs:
test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macOS-10.14, ubuntu-18.04, windows-2019]
java: [8, 11]

steps:
# Check out Git repository
- uses: actions/checkout@v1

# Set up environment with Java and Maven
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}

# Run all tests
- name: Run tests
run: mvn integration-test
130 changes: 63 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,29 @@
## Maven Archetype for SPA Starter Kit
# AEM SPA Project Archetype

This archetype creates a minimal Adobe Experience Manager project as a starting point for your own SPA projects. The properties that must be provided when using this archetype allow to name as desired all parts of this project.

See the [Getting Started with the AEM SPA Editor - WKND Events Tutorial](https://helpx.adobe.com/experience-manager/kt/sites/using/getting-started-spa-wknd-tutorial-develop.html) on the Adobe Help Center website for an example of how to use it.

## Contributing

Contributions are welcome! Read the [Contributing Guide](CONTRIBUTING.md) for more information.

## System requirements

- [Java](https://www.java.com/en/download/) 1.8 or higher
- [Maven](https://maven.apache.org/) 3.5.0 or higher
- Include the [Adobe Public Maven Repository](adobe-public-maven-repo) in your maven settings
- Include the [Adobe Public Maven Repository]([adobe-public-maven-repo](https://repo.adobe.com)) in your Maven settings

It is recommended to set up the local AEM instances with `nosamplecontent` run mode.

Modules of the generated project is defined in [src/main/resources/archetype-resources](src/main/resources):
## Usage

* [core](core/): OSGi bundle containing:
* Java classes (e.g. Sling Models, Servlets, business logic)
* [ui.apps/src/main/content/jcr_root/apps](content/jcr_root/apps/):
* AEM components with their scripts and dialog definitions
* [ui.content/src/main/content/jcr_root/conf](content/jcr_root/conf/):
* AEM content package with editable templates stored at `/conf`
* [ui.content/src/main/content/jcr_root/content](content/jcr_root/content/):
* AEM content package containing sample content (for development and test purposes)
* [angular-app](angular-app/): Angular application in case frontend chosen is set to be "angular" at project generation
* [react-app](react-app/): React application in case frontend chosen is set to be "react" at project generation
* [all](all/): Combines all modules to be installed as content package in AEM
Run the following command to generate a project from the archetype:

## Required parameters
```sh
mvn archetype:generate \
-DarchetypeGroupId=com.adobe.cq.spa.archetypes \
-DarchetypeArtifactId=aem-spa-project-archetype
```

Maven will prompt you for the following parameters:

This archetype requires following parameters:
- `groupId` - Maven artifact groupId for all projects
- `artifactId`(default is `${groupId}.${projectName}`) - Maven artifact "root" artifactId, is suffixed for the individual modules
- `version` (default is `1.0.0-SNAPSHOT`) - Maven artifact version
Expand All @@ -42,75 +33,80 @@ This archetype requires following parameters:
- `componentGroup` (default is `${projectTitle}`) - Name of the component group in AEM Editor
- `optionFrontend` (default is `react`) - Type of frontent project, allowed options: either angular or react

## Building SPA Starter Kit Archetype
See [`archetype-metadata.xml`](./src/main/resources/META-INF/maven/archetype-metadata.xml) for the full list possible parameters.

```
$ mvn clean install archetype:update-local-catalog
```

## Updating list of locally available archetypes
## Modules

```
$ mvn archetype:crawl
```

## Archetype catalog variants
Modules of the generated project is defined in [src/main/resources/archetype-resources](src/main/resources):

Depending on the use case maven can use different archetype variant (use `-DarchetypeCatalog` to choose one):
- `internal` represents `~/.m2/repository/`
- `local` represents `~/.m2/archetype-catalog.xml`
- `remote` represents http://repo.maven.apache.org/maven2/archetype-catalog.xml
* [core](core/): OSGi bundle containing:
* Java classes (e.g. Sling Models, Servlets, business logic)
* [ui.apps/src/main/content/jcr_root/apps](content/jcr_root/apps/):
* AEM components with their scripts and dialog definitions
* [ui.content/src/main/content/jcr_root/conf](content/jcr_root/conf/):
* AEM content package with editable templates stored at `/conf`
* [ui.content/src/main/content/jcr_root/content](content/jcr_root/content/):
* AEM content package containing sample content (for development and test purposes)
* [angular-app](angular-app/): Angular application in case frontend chosen is set to be "angular" at project generation
* [react-app](react-app/): React application in case frontend chosen is set to be "react" at project generation
* [all](all/): Combines all modules to be installed as content package in AEM

## Provided Maven profiles
The generated maven project support different deployment profiles when running the Maven install goal `mvn install` within the reactor.

Id | Description
--------------------------|------------------------------
autoInstallBundle | Install core bundle with the maven-sling-plugin to the felix console
autoInstallPackage | Install the ui.content and ui.apps content package with the content-package-maven-plugin to the package manager to default author instance on localhost, port 4502. Hostname and port can be changed with the aem.host and aem.port user defined properties.
autoInstallPackage | Install the ui.content and ui.apps content package with the content-package-maven-plugin to the package manager to default author instance on localhost, port 4502. Hostname and port can be changed with the aem.host and aem.port user defined properties.
autoInstallPackagePublish | Install the ui.content and ui.apps content package with the content-package-maven-plugin to the package manager to default publish instance on localhost, port 4503. Hostname and port can be changed with the aem.host and aem.port user defined properties.

The profile `integrationTests` is also available for the verify goal, to run the provided integration tests on the AEM instance.

## Using SPA Starter Kit Archetype
## Development

Archetype `aem-spa-project-archetype` must be available locally (by cloning this repo and building it) or on artifactory.
### Building

You must be in a directory without a `pom.xml` file. A sub-folder will be created for the newly created project.
1. Clone this repository: `git clone REPO_URL`
2. Navigate into the project directory: `cd aem-spa-project-archetype`
3. Add the archetype to the local archetype catalog: `mvn clean install archetype:update-local-catalog`
4. Navigate into a different directory where you want to generate a project from the archetype
5. Update the list of locally available archetypes: `mvn archetype:crawl`
6. Generate a project from the local archetype:

Starter Kit project can be created using following options:
- in command line in **interactive** mode
- in command line in **batch** mode
```sh
mvn archetype:generate \
-DarchetypeCatalog=local \
-DarchetypeGroupId=com.adobe.cq.spa.archetypes \
-DarchetypeArtifactId=aem-spa-project-archetype
```

### Creating project in interactive mode
### Contributing

In interactive mode a series of questions will be asked set parameters for new project.
Contributions are welcome! Read the [Contributing Guide](CONTRIBUTING.md) for more information.

```
$ mvn archetype:generate \
-DarchetypeCatalog=internal \
-DarchetypeGroupId=com.adobe.cq.spa.archetypes \
-DarchetypeArtifactId=aem-spa-project-archetype \
-DarchetypeVersion=1.0.5-SNAPSHOT \
```
### Releasing

Please note that properties declared in [archetype-metadata.xml](src/main/resources/META-INF/maven/archetype-metadata.xml) with `defaultValue` are not asked during interactive mode and are defaulted to suggested values.
On every commit to the `development` branch, GitHub Actions will run the tests and make a snapshot deployment if they are successful. To create and deploy a (non-snapshot) release, run the following commands:

### Creating project in batch mode
```sh
# Remove "-SNAPSHOT" from the version number in the POM file
mvn versions:set -DremoveSnapshot

In batch mode all the required parameters muse be set via `-Dparameter=value` argument.
# Commit and tag the changes
git commit -am "v1.2.3" # Replace with your version number
git tag "v1.2.3" # Replace with your version number
git push --follow-tags
```
$ mvn archetype:generate -B \
-DarchetypeCatalog=local \
-DarchetypeGroupId=com.adobe.cq.spa.archetypes \
-DarchetypeArtifactId=aem-spa-project-archetype \
-DarchetypeVersion=1.0.5-SNAPSHOT \
-Dpackage=<package> \
-DgroupId=<group-id> \
-DartifactId=<artifact-id> \
-Dversion=<version> \
-DprojectTitle="<project-title>" \
-DprojectName=<project-name> \
-DcomponentGroup=<component-group> \
-DoptionFrontend=react

If the tests pass on CI, this will deploy the project to OSSRH and automatically release it to the Central Repository.

After successfully creating a new release, create a new snapshot version to be able to continue development:

```sh
# Increase and add "-SNAPSHOT" to the version number in the POM file
mvn versions:set -DnextSnapshot

# Commit the changes
git commit -am "Prepare next development iteration"
git push
```
Loading

0 comments on commit 82e3a6b

Please sign in to comment.