From 4ebb7fce8865a75ecd1a34e61a0c3a2309c3f641 Mon Sep 17 00:00:00 2001 From: David Bloss Date: Fri, 13 Dec 2024 12:12:12 -0600 Subject: [PATCH] split out Docker based action from CLI one --- .github/workflows/test.yml | 16 ++++++++++------ README.md | 35 ++++++++++++++++++++++++----------- action.yml | 23 ++--------------------- 3 files changed, 36 insertions(+), 38 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7ad6583..11d7dae 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,20 +9,24 @@ on: - '**/*' jobs: - test: + test-report-deploy-with-cli: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - - name: Report Deploy with Docker + - name: Report Deploy with CLI uses: ./ with: integration_url: ${{ secrets.OL_TEST_DEPLOY_URL }} service: "report_deploy_github_action" - use_docker: "true" - - name: Report Deploy with CLI - uses: ./ + + test-report-deploy-with-docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Report Deploy with Docker + uses: ./with-docker with: integration_url: ${{ secrets.OL_TEST_DEPLOY_URL }} service: "report_deploy_github_action" - use_docker: "false" diff --git a/README.md b/README.md index 1ad30d3..098d5ef 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This action emits a deploy event for service to OpsLevel. We have configured it with sane defaults so you should only have to specify `integration_url` and `service`. `environment` defaults to `production` so if you want to track deploys from other environments you'll want to specify that too. -## Example usage +## Example usage - uses OpsLevel CLI directly ```yaml jobs: @@ -12,12 +12,26 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Report Deploy - uses: OpsLevel/report-deploy-github-action@v2.0.0 + - name: Report Deploy using OpsLevel CLI + uses: OpsLevel/report-deploy-github-action@v3.0.0 + with: + integration_url: ${{ secrets.DEPLOY_INTEGRATION_URL }} + service: "my-service" +``` + +## Example usage - uses Docker image + +```yaml +jobs: + deploy: + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Report Deploy using Docker + uses: OpsLevel/report-deploy-github-action/with-docker@v3.0.0 with: integration_url: ${{ secrets.DEPLOY_INTEGRATION_URL }} service: "my-service" - use_docker: "true" ``` ## Inputs @@ -60,17 +74,16 @@ The deploy url that OpsLevel points to - Default: `${{ github.server_url }}/${{ An identifier that can be used to deduplicate deployments - Default: `${{ github.run_id }}` -### `use_docker` +## Reporting Deploy with Docker or OpsLevel CLI -Send deploy using Docker container if "true" - use OpsLevel CLI otherwise - Default: `true` +This action can be run using either Docker or the OpsLevel CLI, both have identical inputs and behave identically. -## Reporting Deploy with Docker or OpsLevel CLI +To report deploys to OpsLevel with the OpsLevel CLI based Github Action (default), add `uses: OpsLevel/report-deploy-github-action@v3.0.0` to your workflow. -This action can be run using either Docker or the OpsLevel CLI, depending on the value of the `use_docker` input. +To report deploys to OpsLevel with the Docker based Github Action, add `uses: OpsLevel/report-deploy-github-action/with-docker@v3.0.0` to your workflow. -While both behave identically, this action will run using Docker by default - see [./with-docker](./with-docker). For Github workflows operating within intentional constraints, perhaps where building public Docker images is not -an option, it may be preferable to use the OpsLevel CLI. +an option, it may be preferable to use the default OpsLevel CLI. ## Overriding Defaults Example @@ -88,7 +101,7 @@ jobs: DEPLOYER=$(git show -s --format='%ae') echo "DEPLOYER=${DEPLOYER}" >> $GITHUB_OUTPUT - name: Report Deploy - uses: OpsLevel/report-deploy-github-action@v2.0.0 + uses: OpsLevel/report-deploy-github-action@v3.0.0 with: integration_url: ${{ secrets.DEPLOY_INTEGRATION_URL }} service: "my-service" diff --git a/action.yml b/action.yml index af2e517..86647fd 100644 --- a/action.yml +++ b/action.yml @@ -40,37 +40,18 @@ inputs: description: 'The service alias for the event' required: false default: ${{ github.repository }} - use_docker: - description: 'Send deploy using docker if "true" - use OpsLevel CLI otherwise' - required: false - default: 'true' runs: using: "composite" steps: + - name: Install OpsLevel CLI + uses: opslevel/actions/setup-cli@v1 - name: Mask inputs shell: bash run: | set +v echo ::add-mask::${{ inputs.integration_url }} set -v - - name: Do it with Docker - if: ${{ inputs.use_docker == 'true' }} - uses: OpsLevel/report-deploy-github-action/with-docker@v2.0.0 - with: - integration_url: ${{ inputs.integration_url }} - deduplication_id: ${{ inputs.deduplication_id }} - deployer_email: ${{ inputs.deployer_email }} - deploy_url: ${{ inputs.deploy_url }} - deployer_name: ${{ inputs.deployer_name }} - description: ${{ inputs.description }} - environment: ${{ inputs.environment }} - number: ${{ inputs.number }} - service: ${{ inputs.service }} - - name: Install OpsLevel CLI - if: ${{ inputs.use_docker != 'true' }} - uses: opslevel/actions/setup-cli@v1 - name: Report Deploy to OpsLevel - if: ${{ inputs.use_docker != 'true' }} shell: bash run: | cat < data.yaml