|
| 1 | +name: "Homebrew" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: &inputs |
| 6 | + name: |
| 7 | + description: "Package Name" |
| 8 | + type: string |
| 9 | + default: "npmstat" |
| 10 | + version: |
| 11 | + description: "Build Version" |
| 12 | + type: string |
| 13 | + required: true |
| 14 | + workflow_dispatch: |
| 15 | + inputs: *inputs |
| 16 | + |
| 17 | +jobs: |
| 18 | + homebrew: |
| 19 | + name: "Homebrew" |
| 20 | + runs-on: ubuntu-latest |
| 21 | + timeout-minutes: 5 |
| 22 | + |
| 23 | + permissions: |
| 24 | + contents: read |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: "PyPi URL" |
| 28 | + id: url |
| 29 | + uses: cssnr/web-request-action@master |
| 30 | + with: |
| 31 | + method: "GET" |
| 32 | + url: "https://pypi.org/pypi/${{ inputs.name }}/${{ inputs.version }}/json" |
| 33 | + path: '$.urls[?(@.packagetype=="sdist")]' |
| 34 | + |
| 35 | + - name: "Validate Outputs" |
| 36 | + uses: cssnr/validate-outputs-action@master |
| 37 | + with: |
| 38 | + outputs: ${{ toJSON(steps.url.outputs) }} |
| 39 | + data: | |
| 40 | + url: |
| 41 | + sha256: |
| 42 | +
|
| 43 | + #- name: "Verify URL" |
| 44 | + # env: |
| 45 | + # url: ${{ fromJSON(steps.url.outputs.result).url }} |
| 46 | + # sha256: ${{ fromJSON(steps.url.outputs.result).digests.sha256 }} |
| 47 | + # run: | |
| 48 | + # echo "download-url: ${url}" |
| 49 | + # echo "download-sha256: ${sha256}" |
| 50 | + # if [ -z "${url}" ];then |
| 51 | + # echo "Missing URL" && exit 1 |
| 52 | + # fi |
| 53 | + # if [ -z "${sha256}" ];then |
| 54 | + # echo "Missing SHA256" && exit 1 |
| 55 | + # fi |
| 56 | + |
| 57 | + - name: "Homebrew Action" |
| 58 | + id: homebrew |
| 59 | + uses: cssnr/homebrew-action@master |
| 60 | + with: |
| 61 | + url: ${{ fromJSON(steps.url.outputs.result).url }} |
| 62 | + sha256: ${{ fromJSON(steps.url.outputs.result).digests.sha256 }} |
| 63 | + repo: cssnr/homebrew-tap |
| 64 | + formula: ${{ inputs.name }} |
| 65 | + message: Bump ${{ inputs.name }} to ${{ github.ref_name }} |
| 66 | + branch: master |
| 67 | + app_id: 146360 |
| 68 | + app_private_key: ${{ secrets.APP_PRIVATE_KEY }} |
| 69 | + |
| 70 | + #- name: "Homebrew Formula Action" |
| 71 | + # uses: mislav/bump-homebrew-formula-action@56a283fa15557e9abaa4bdb63b8212abc68e655c # v3.6 |
| 72 | + # env: |
| 73 | + # COMMITTER_TOKEN: ${{ secrets.HOMEBREW_PAT }} |
| 74 | + # with: |
| 75 | + # formula-name: "${{ inputs.name }}" |
| 76 | + # tag-name: ${{ github.ref_name }} |
| 77 | + # download-url: ${{ fromJSON(steps.url.outputs.result).url }} |
| 78 | + # download-sha256: ${{ fromJSON(steps.url.outputs.result).digests.sha256 }} |
| 79 | + # homebrew-tap: "cssnr/homebrew-tap" |
| 80 | + # create-pullrequest: false |
| 81 | + # create-branch: false |
| 82 | + # commit-message: "Bump {{formulaName}} to {{version}}" |
0 commit comments