Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ Note: Since the action is not interactive, it invokes the CLI via `clojure` rath

**Required**: The name of the datomic cloud stack.

### `uname`

**Optional:** The [unreproducible name](https://docs.datomic.com/cloud/ions/ions-reference.html#unreproducible) for the push.

### `maven-settings`

**Optional:** The path to a custom maven settings.xml. Useful if you reference dependencies in a private maven repository.

### `maven-repository`

**Optional:** The path to your custom maven repository (eg "/github/workspace/.m2/repository"). Useful when used in combination with the [Cache Action](https://github.com/marketplace/actions/cache) in order to be able to specify a path to the maven repository visible outside this docker container.

### `ssh-key`

**Optional:** A GitHub secret that has the The SSH key needed to access code from other private repositories (eg `${{ secrets.SSH_PRIVATE_KEY }}`)
Expand Down Expand Up @@ -158,7 +170,7 @@ Make sure that the AWS access keys you are providing to the action have an IAM p

### default, to run `:ion-dev` alias

```yaml
```yaml
- name: Deploy Datomic ions
uses: actions/[email protected]
with:
Expand All @@ -172,7 +184,7 @@ Make sure that the AWS access keys you are providing to the action have an IAM p

When you need to fetch private gitlibs with tools.deps, use `ssh-key`

```yaml
```yaml
- name: Deploy Datomic ions
uses: actions/[email protected]
with:
Expand All @@ -186,7 +198,7 @@ When you need to fetch private gitlibs with tools.deps, use `ssh-key`

### with an alternative alias

```yaml
```yaml
- name: Deploy Datomic ions
uses: actions/[email protected]
with:
Expand All @@ -200,13 +212,13 @@ When you need to fetch private gitlibs with tools.deps, use `ssh-key`

### with a different working directory

In case you want to use this action in a repository that has the ions code in a directory other than the root,
use the `working-dir` parameter.
In case you want to use this action in a repository that has the ions code in a directory other than the root,
use the `working-dir` parameter.

Another use case might be that you have a github workflow that needs to run tests against a specific version of
the ions code that is stored in another repository.

```yaml
```yaml
- uses: actions/checkout@v2

# Checkout the ions code from another repository
Expand All @@ -233,4 +245,3 @@ the ions code that is stored in another repository.

# License
The scripts and documentation in this project are released under the [MIT License](LICENSE)

12 changes: 12 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ inputs:
app-name:
description: "The datomic app name specified with the CloudFormation stack"
required: true
uname:
description: "The uname for this deploy"
required: false
maven-settings:
description: "The path to maven settings.xml"
required: false
maven-repository:
description: "The path to maven repository"
required: false
runs:
using: 'docker'
image: 'Dockerfile'
Expand All @@ -43,3 +52,6 @@ runs:
- ${{ inputs.working-directory }}
- ${{ inputs.app-name }}
- ${{ inputs.ssh-key }}
- ${{ inputs.uname }}
- ${{ inputs.maven-settings}}
- ${{ inputs.maven-repository}}
38 changes: 36 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ export AWS_SECRET_ACCESS_KEY=$5
WORKING_DIR=$6
APP_NAME=$7
SSH_KEY=$8
UNAME=$9
MAVEN_SETTINGS=${10}
MAVEN_REPOSITORY=${11}

## Setup maven settings
if [[ -n $MAVEN_SETTINGS ]]; then
cp $MAVEN_SETTINGS $HOME/.m2/settings.xml
fi

## Setup maven repository
if [[ -n $MAVEN_REPOSITORY ]]; then
rm -rf $HOME/.m2/repository
mkdir -p $MAVEN_REPOSITORY
mv $MAVEN_REPOSITORY $HOME/.m2/repository
fi

## Setup SSH Agent
if [[ -n $SSH_KEY ]]
Expand Down Expand Up @@ -55,7 +70,12 @@ function get_version {

function push {
# Push the ions code to AWS
clojure $a_Opts "{:op :push :region $AWS_REGION}"

if [[ -n $UNAME ]]; then
clojure $a_Opts "{:op :push :region $AWS_REGION :uname $UNAME}"
else
clojure $a_Opts "{:op :push :region $AWS_REGION}"
fi
}

function getDeployStatus() {
Expand Down Expand Up @@ -92,7 +112,11 @@ function deploy {

## if this fails, print out the error instead of sending it to the file
set +e
CLJ_OUTPUT=$(clojure -Sforce -A:ion-dev "{:op :deploy, :region $AWS_REGION, :group $1, :rev \"$SHA\"}")
if [[ -n $UNAME ]]; then
CLJ_OUTPUT=$(clojure -Sforce -A:ion-dev "{:op :deploy, :region $AWS_REGION, :group $1, :uname \"$UNAME\"}")
else
CLJ_OUTPUT=$(clojure -Sforce -A:ion-dev "{:op :deploy, :region $AWS_REGION, :group $1, :rev \"$SHA\"}")
fi

if [ $? -eq 0 ]; then
echo $CLJ_OUTPUT >.deploys/$1_$SHA
Expand All @@ -106,7 +130,17 @@ function deploy {
waitUntilDeployed "$1_$SHA"
}

function prepare-maven-cache {

if [[ -n $MAVEN_REPOSITORY ]]; then
rm -rf $MAVEN_REPOSITORY
mv $HOME/.m2/repository $MAVEN_REPOSITORY
fi

}

if [[ $SHA != $(get_version $COMPUTE_GROUP $APP_NAME) ]]; then
push
deploy $COMPUTE_GROUP
prepare-maven-cache
fi