|
| 1 | +name: Prepare custom p2 |
| 2 | +description: Prepares a custom p2 repository. Intended to be run from a PR only. |
| 3 | + |
| 4 | +inputs: |
| 5 | + repo: |
| 6 | + description: "The repository to check out the custom p2 from" |
| 7 | + required: true |
| 8 | + |
| 9 | +outputs: |
| 10 | + p2-found: |
| 11 | + description: "Whether a custom p2 repository for the current branch was found" |
| 12 | + value: ${{ steps.find-p2.outputs.p2-found }} |
| 13 | + |
| 14 | +runs: |
| 15 | + using: "composite" |
| 16 | + steps: |
| 17 | + - name: Find p2 |
| 18 | + id: find-p2 |
| 19 | + shell: bash |
| 20 | + env: |
| 21 | + REPO: ${{ inputs.repo }} |
| 22 | + run: | |
| 23 | + uri_encoded_branch_name=$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$GITHUB_HEAD_REF") |
| 24 | + echo "uri_encoded_branch_name=$uri_encoded_branch_name" |
| 25 | + http_status=$(curl -s -o /dev/null -w "%{http_code}" \ |
| 26 | + -H "Accept: application/vnd.github.v3+json" \ |
| 27 | + "https://api.github.com/repos/$GITHUB_REPOSITORY_OWNER/$REPO/branches/$uri_encoded_branch_name") |
| 28 | + echo "httpstatus=$http_status" |
| 29 | + if [ "$http_status" = '200' ]; then |
| 30 | + echo "p2-found=true" >> "$GITHUB_OUTPUT" |
| 31 | + else |
| 32 | + echo "p2-found=false" >> "$GITHUB_OUTPUT" |
| 33 | + fi |
| 34 | +
|
| 35 | + - name: Checkout p2 and its dependencies |
| 36 | + uses: dbeaver/github-actions/checkout-with-deps@dbeaver/dbeaver-devops#2023-custom-p2 # CHANGEME after PR approval |
| 37 | + if: ${{ steps.find-p2.outputs.p2-found == 'true' }} |
| 38 | + with: |
| 39 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + owner: ${{ github.repository_owner }} |
| 41 | + repo: ${{ inputs.repo }} |
| 42 | + ref: ${{ github.head_ref }} |
| 43 | + |
| 44 | + - name: Build custom p2 |
| 45 | + uses: dbeaver/github-actions/build-p2@dbeaver/dbeaver-devops#2023-custom-p2 # CHANGEME after PR approval |
| 46 | + if: ${{ steps.find-p2.outputs.p2-found == 'true' }} |
| 47 | + with: |
| 48 | + repo-root-dir: ./${{ inputs.repo }} |
0 commit comments