|
7 | 7 | pull_request: |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - Pre-Check: |
11 | | - if: | |
12 | | - github.event.pull_request.merged && |
13 | | - endsWith(github.event.pull_request.title, '/workflows/release-pr') && |
14 | | - github.event.pull_request.user.login != 'polywrap-build-bot' |
15 | | - runs-on: ubuntu-18.04 |
16 | | - steps: |
17 | | - - name: Checkout |
18 | | - uses: actions/checkout@v3 |
19 | | - with: |
20 | | - ref: ${{github.event.pull_request.base.ref}} |
21 | | - |
22 | | - - name: Pull-Request Creator Is Publisher? |
23 | | - run: | |
24 | | - exists=$(echo $(grep -Fxcs ${CREATOR} .github/PUBLISHERS)) |
25 | | - if [ "$exists" == "1" ] ; then |
26 | | - echo IS_PUBLISHER=true >> $GITHUB_ENV |
27 | | - else |
28 | | - echo IS_PUBLISHER=false >> $GITHUB_ENV |
29 | | - fi |
30 | | - env: |
31 | | - CREATOR: ${{github.event.pull_request.user.login}} |
32 | | - |
33 | | - - name: Creator Is Not Publisher... |
34 | | - if: env.IS_PUBLISHER == 'false' |
35 | | - uses: actions/github-script@0.8.0 |
36 | | - with: |
37 | | - github-token: ${{secrets.GITHUB_TOKEN}} |
38 | | - script: | |
39 | | - github.issues.createComment({ |
40 | | - issue_number: context.issue.number, |
41 | | - owner: context.repo.owner, |
42 | | - repo: context.repo.repo, |
43 | | - body: '${{github.event.pull_request.user.login}} is not a PUBLISHER. Please see the .github/PUBLISHERS file...' |
44 | | - }) |
45 | | -
|
46 | | - - name: Read VERSION into env.RELEASE_VERSION |
47 | | - run: echo RELEASE_VERSION=$(cat VERSION) >> $GITHUB_ENV |
48 | | - |
49 | | - - name: Tag Exists? |
50 | | - id: tag_check |
51 | | - shell: bash -ex {0} |
52 | | - run: | |
53 | | - GET_API_URL="https://api.github.com/repos/${{github.repository}}/git/ref/tags/${{env.RELEASE_VERSION}}" |
54 | | - http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \ |
55 | | - -H "Authorization: token ${GITHUB_TOKEN}") |
56 | | - if [ "$http_status_code" -ne "404" ] ; then |
57 | | - echo TAG_EXISTS=true >> $GITHUB_ENV |
58 | | - else |
59 | | - echo TAG_EXISTS=false >> $GITHUB_ENV |
60 | | - fi |
61 | | - env: |
62 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
63 | | - |
64 | | - - name: Release Already Exists... |
65 | | - if: env.TAG_EXISTS == 'true' |
66 | | - uses: actions/github-script@0.8.0 |
67 | | - with: |
68 | | - github-token: ${{secrets.GITHUB_TOKEN}} |
69 | | - script: | |
70 | | - github.issues.createComment({ |
71 | | - issue_number: context.issue.number, |
72 | | - owner: context.repo.owner, |
73 | | - repo: context.repo.repo, |
74 | | - body: '[Release Already Exists](https://api.github.com/repos/${{github.repository}}/git/ref/tags/${{env.RELEASE_VERSION}}) (`${{env.RELEASE_VERSION}}`)' |
75 | | - }) |
76 | | -
|
77 | | - - name: Fail If Conditions Aren't Met... |
78 | | - if: | |
79 | | - env.IS_PUBLISHER != 'true' || |
80 | | - env.TAG_EXISTS != 'false' |
81 | | - run: exit 1 |
| 10 | + # Pre-Check: |
| 11 | + # if: | |
| 12 | + # github.event.pull_request.merged && |
| 13 | + # endsWith(github.event.pull_request.title, '/workflows/release-pr') && |
| 14 | + # github.event.pull_request.user.login != 'polywrap-build-bot' |
| 15 | + # runs-on: ubuntu-18.04 |
| 16 | + # steps: |
| 17 | + # - name: Checkout |
| 18 | + # uses: actions/checkout@v3 |
| 19 | + # with: |
| 20 | + # ref: ${{github.event.pull_request.base.ref}} |
| 21 | + |
| 22 | + # - name: Pull-Request Creator Is Publisher? |
| 23 | + # run: | |
| 24 | + # exists=$(echo $(grep -Fxcs ${CREATOR} .github/PUBLISHERS)) |
| 25 | + # if [ "$exists" == "1" ] ; then |
| 26 | + # echo IS_PUBLISHER=true >> $GITHUB_ENV |
| 27 | + # else |
| 28 | + # echo IS_PUBLISHER=false >> $GITHUB_ENV |
| 29 | + # fi |
| 30 | + # env: |
| 31 | + # CREATOR: ${{github.event.pull_request.user.login}} |
| 32 | + |
| 33 | + # - name: Creator Is Not Publisher... |
| 34 | + # if: env.IS_PUBLISHER == 'false' |
| 35 | + # uses: actions/github-script@0.8.0 |
| 36 | + # with: |
| 37 | + # github-token: ${{secrets.GITHUB_TOKEN}} |
| 38 | + # script: | |
| 39 | + # github.issues.createComment({ |
| 40 | + # issue_number: context.issue.number, |
| 41 | + # owner: context.repo.owner, |
| 42 | + # repo: context.repo.repo, |
| 43 | + # body: '${{github.event.pull_request.user.login}} is not a PUBLISHER. Please see the .github/PUBLISHERS file...' |
| 44 | + # }) |
| 45 | + |
| 46 | + # - name: Read VERSION into env.RELEASE_VERSION |
| 47 | + # run: echo RELEASE_VERSION=$(cat VERSION) >> $GITHUB_ENV |
| 48 | + |
| 49 | + # - name: Tag Exists? |
| 50 | + # id: tag_check |
| 51 | + # shell: bash -ex {0} |
| 52 | + # run: | |
| 53 | + # GET_API_URL="https://api.github.com/repos/${{github.repository}}/git/ref/tags/${{env.RELEASE_VERSION}}" |
| 54 | + # http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \ |
| 55 | + # -H "Authorization: token ${GITHUB_TOKEN}") |
| 56 | + # if [ "$http_status_code" -ne "404" ] ; then |
| 57 | + # echo TAG_EXISTS=true >> $GITHUB_ENV |
| 58 | + # else |
| 59 | + # echo TAG_EXISTS=false >> $GITHUB_ENV |
| 60 | + # fi |
| 61 | + # env: |
| 62 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + |
| 64 | + # - name: Release Already Exists... |
| 65 | + # if: env.TAG_EXISTS == 'true' |
| 66 | + # uses: actions/github-script@0.8.0 |
| 67 | + # with: |
| 68 | + # github-token: ${{secrets.GITHUB_TOKEN}} |
| 69 | + # script: | |
| 70 | + # github.issues.createComment({ |
| 71 | + # issue_number: context.issue.number, |
| 72 | + # owner: context.repo.owner, |
| 73 | + # repo: context.repo.repo, |
| 74 | + # body: '[Release Already Exists](https://api.github.com/repos/${{github.repository}}/git/ref/tags/${{env.RELEASE_VERSION}}) (`${{env.RELEASE_VERSION}}`)' |
| 75 | + # }) |
| 76 | + |
| 77 | + # - name: Fail If Conditions Aren't Met... |
| 78 | + # if: | |
| 79 | + # env.IS_PUBLISHER != 'true' || |
| 80 | + # env.TAG_EXISTS != 'false' |
| 81 | + # run: exit 1 |
82 | 82 |
|
83 | 83 | Release-PR: |
84 | | - needs: Pre-Check |
| 84 | + # needs: Pre-Check |
85 | 85 | runs-on: ubuntu-18.04 |
86 | 86 | steps: |
87 | 87 | - name: Checkout |
|
0 commit comments