diff --git a/.github/workflows/docker-pr-cleanup.yml b/.github/workflows/docker-pr-cleanup.yml index aee8f02..8f5f402 100644 --- a/.github/workflows/docker-pr-cleanup.yml +++ b/.github/workflows/docker-pr-cleanup.yml @@ -25,17 +25,15 @@ on: required: true description: "Pull Request Number (github.event.pull_request.number)" type: string - # pull_request: - # types: - # - closed jobs: metadata: name: "Generate Metadata" runs-on: ubuntu-latest outputs: + user-type: ${{steps.userdata.outputs.type}} version-url: ${{steps.version-url.outputs.url}} - version-id: ${{steps.version-id.outputs.VERSION_ID}} + version-id: ${{steps.version-id.outputs.version_id}} steps: - name: Get User Type from API id: userdata @@ -88,11 +86,9 @@ jobs: -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer ${{secrets.GITHUB_TOKEN}}" \ "${{steps.version-url.outputs.url}}" >> ${HOME}/versionIds.json - echo "VERSION_ID=$(jq -r ".[] | select(.metadata.container.tags | index(\"pr-${{ inputs.pull-request-number }}\")).id" ${HOME}/versionIds.json)" | tee -a "${GITHUB_OUTPUT}" - - name: Print Version ID JSON - run: cat ${HOME}/versionIds.json + echo "version_id=$(jq -r ".[] | select(.metadata.container.tags | index(\"pr-${{ inputs.pull-request-number }}\")).id" ${HOME}/versionIds.json)" | tee -a "${GITHUB_OUTPUT}" - name: Print Version ID - run: echo "The selected Version ID is ${{ steps.version-id.outputs.VERSION_ID }}" + run: echo "The selected Version ID is ${{ steps.version-id.outputs.version_id }}" # this job will only run if the PR has been merged merge_job: diff --git a/README.md b/README.md index 4076465..8443fb8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,67 @@ # actions GitHub Reusable Actions + +## Usage + +## Unit Testing + +```yaml +name: CI + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + unit-test: + name: "Unit Test" + uses: dosquad/actions/.github/workflows/unit-test.yml@main + secrets: inherit +``` + +### Docker Release + +```yaml +name: "Docker Release" + +on: + pull_request: + push: + branches: + - main + +jobs: + docker: + name: "Docker" + uses: dosquad/actions/.github/workflows/docker-release.yml@main + with: + image: ghcr.io/dosquad/database-operator + platforms: 'linux/amd64,linux/arm64' + latest-on-branch: '{{is_default_branch}}' + secrets: inherit + +``` + +### Docker PR Cleanup + +```yaml +name: Cleanup on Closed Pull Request + +on: + pull_request: + types: + - closed + +jobs: + docker: + name: "Docker Cleanup" + uses: dosquad/actions/.github/workflows/docker-pr-cleanup.yml@main + with: + package-name: database-operator + owner: "${{github.repository_owner}}" + pull-request-merged: "${{github.event.inputs.pull-request-merged}}" + pull-request-number: "${{github.event.pull_request.number}}" + secrets: inherit +```