diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml new file mode 100644 index 0000000..a37c537 --- /dev/null +++ b/.github/workflows/build-and-test.yaml @@ -0,0 +1,13 @@ +name: Build and Test +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + # Check out repository $GITHUB_WORKSPACE + - uses: actions/checkout@v2 + # Build and Run Unit Tests + - name: Build and Run Unit Tests + run: mvn clean test diff --git a/.github/workflows/check-stable-dependency.yaml b/.github/workflows/check-stable-dependency.yaml new file mode 100644 index 0000000..98e65ae --- /dev/null +++ b/.github/workflows/check-stable-dependency.yaml @@ -0,0 +1,21 @@ +name: Check Stable Dependencies +on: [pull_request, workflow_dispatch] + +jobs: + check_dependency: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Resolve Dependencies + run: mvn dependency:resolve + - name: List and Check for snapshot + run: | + export SNAPSHOT_COUNT=$(mvn -o dependency:list | grep -e "SNAPSHOT" | wc -l) + if [ $SNAPSHOT_COUNT -gt 0 ] + then + exit 1 + fi + + + diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml new file mode 100644 index 0000000..7e9fb36 --- /dev/null +++ b/.github/workflows/publish-docker.yaml @@ -0,0 +1,50 @@ +name: Publish Docker +on: + workflow_dispatch: + inputs: + tag: + description: 'The tag to apply to the Docker file' + type: string +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-publish-docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + outputs: + jar_version: ${{ steps.package.outputs.jar_version }} + steps: + - uses: actions/checkout@v2 + # Build and Run Unit Tests + - name: Package Jar + id: package + run: | + mvn package + echo "::set-output name=jar_version::$(mvn help:evaluate -Dexpression=project.version | grep -e '^[1-9][^\[]')" + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=sha,prefix=${{ steps.package.outputs.jar_version }}-,format=short + type=raw,value=${{ github.event.inputs.tag }} + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + JAR_VERSION=${{ steps.package.outputs.jar_version }} diff --git a/pom.xml b/pom.xml index 86b2d59..70e1fad 100644 --- a/pom.xml +++ b/pom.xml @@ -24,12 +24,12 @@ com.uid2 enclave-attestation-api - 1.0.0 + 1.1.0 com.uid2 uid2-shared - 1.0.0 + 1.1.0 io.vertx diff --git a/setup_dependencies.sh b/setup_dependencies.sh deleted file mode 100755 index 8b9ebe0..0000000 --- a/setup_dependencies.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -mkdir dependencies -cd dependencies - -echo 'enclave-attestation-api: download' -git clone git@github.com:UnifiedID2/enclave-attestation-api-java.git - -VERSION=${1:-"1.0.0"} -GROUP_ID="com.uid2" -ARTIFACT_ID="enclave-attestation-api" - -echo 'enclave-attestation-api: build & install' -pushd enclave-attestation-api-java || exit -mvn package && mvn install:install-file -Dfile="./target/$ARTIFACT_ID-$VERSION.jar" -DgroupId="$GROUP_ID" -DartifactId="$ARTIFACT_ID" -Dpackaging=jar -Dversion="$VERSION" -popd - -echo 'uid2-shared: download' -git clone git@github.com:UnifiedID2/uid2-shared.git - -VERSION=${1:-"1.0.0"} -GROUP_ID="com.uid2" -ARTIFACT_ID="uid2-shared" - -echo 'uid2-shared: build & install' -pushd uid2-shared || exit -mvn package && mvn install:install-file -Dfile="./target/$ARTIFACT_ID-$VERSION.jar" -DgroupId="$GROUP_ID" -DartifactId="$ARTIFACT_ID" -Dpackaging=jar -Dversion="$VERSION" -popd -