From e3eb80b4336c3458fe90e9338b0414cd8870dd40 Mon Sep 17 00:00:00 2001 From: Daniel Mikusa Date: Fri, 25 Feb 2022 14:42:45 -0500 Subject: [PATCH] Add CI for creating liberty action Signed-off-by: Daniel Mikusa --- .github/pipeline-descriptor.yml | 2 + .../create-action-liberty-dependency.yml | 55 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 .github/workflows/create-action-liberty-dependency.yml diff --git a/.github/pipeline-descriptor.yml b/.github/pipeline-descriptor.yml index 7697945e..b0d66d2b 100644 --- a/.github/pipeline-descriptor.yml +++ b/.github/pipeline-descriptor.yml @@ -52,6 +52,8 @@ actions: target: ghcr.io/paketo-buildpacks/actions/jrebel-dependency - source: leiningen-dependency target: ghcr.io/paketo-buildpacks/actions/leiningen-dependency +- source: liberty-dependency + target: ghcr.io/paketo-buildpacks/actions/liberty-dependency - source: maven-dependency target: ghcr.io/paketo-buildpacks/actions/maven-dependency - source: new-relic-dependency diff --git a/.github/workflows/create-action-liberty-dependency.yml b/.github/workflows/create-action-liberty-dependency.yml new file mode 100644 index 00000000..216381a6 --- /dev/null +++ b/.github/workflows/create-action-liberty-dependency.yml @@ -0,0 +1,55 @@ +name: Create Action liberty-dependency +"on": + pull_request: + paths: + - actions/* + - actions/liberty-dependency/* + push: + branches: + - main + paths: + - actions/* + - actions/liberty-dependency/* + release: + types: + - published +jobs: + create-action: + name: Create Action + runs-on: + - ubuntu-latest + steps: + - name: Docker login ghcr.io + if: ${{ (github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork) && (github.actor != 'dependabot[bot]') }} + uses: docker/login-action@v1 + with: + password: ${{ secrets.JAVA_GITHUB_TOKEN }} + registry: ghcr.io + username: ${{ secrets.JAVA_GITHUB_USERNAME }} + - uses: actions/checkout@v2 + - name: Create Action + run: | + #!/usr/bin/env bash + + set -euo pipefail + + echo "::group::Building ${TARGET}:${VERSION}" + docker build \ + --file actions/Dockerfile \ + --build-arg "SOURCE=${SOURCE}" \ + --tag "${TARGET}:${VERSION}" \ + . + echo "::endgroup::" + + if [[ "${PUSH}" == "true" ]]; then + echo "::group::Pushing ${TARGET}:${VERSION}" + docker push "${TARGET}:${VERSION}" + echo "::endgroup::" + else + echo "Skipping push" + fi + env: + PUSH: ${{ github.event_name != 'pull_request' }} + SOURCE: liberty-dependency + TARGET: ghcr.io/paketo-buildpacks/actions/liberty-dependency + VERSION: main