cloudflare/cfssl_trust
Publicmirrored from https://github.com/cloudflare/cfssl_trustAvailable
.github/workflows/manual-release.yml
65lines · modecode
| 1 | name: Manual Release |
| 2 | on: |
| 3 | workflow_dispatch: |
| 4 | inputs: |
| 5 | expirationWindow: |
| 6 | description: 'Remove certs that expire in a forward looking window of N hours. e.g. Defaults to: "168h" (1 week)' |
| 7 | default: '168h' |
| 8 | required: false |
| 9 | addIntermediates: |
| 10 | description: 'Adds certificates to the intermediates bundle' |
| 11 | default: '' |
| 12 | required: false |
| 13 | addRoots: |
| 14 | description: 'Adds certificates to the roots bundle' |
| 15 | default: '' |
| 16 | required: false |
| 17 | allowSkipPR: |
| 18 | description: 'Skips the creation of a release if there are no changes. Boolean: true or false' |
| 19 | default: 'true' |
| 20 | required: false |
| 21 | jobs: |
| 22 | create_release: |
| 23 | env: |
| 24 | LATEST_RELEASE: replace |
| 25 | CREATE_PR: false |
| 26 | runs-on: ubuntu-latest |
| 27 | steps: |
| 28 | - name: Check out code |
| 29 | uses: actions/checkout@v2 |
| 30 | - name: Set up Go |
| 31 | uses: actions/setup-go@v2 |
| 32 | with: |
| 33 | go-version: '1.17' |
| 34 | - run: go version |
| 35 | - name: Install dependencies |
| 36 | run: | |
| 37 | go install github.com/kisom/goutils/cmd/certdump@latest |
| 38 | go install github.com/cloudflare/cfssl/cmd/...@latest |
| 39 | go install github.com/cloudflare/cfssl_trust/...@latest |
| 40 | - name: Setup git user |
| 41 | run: | |
| 42 | git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)" |
| 43 | git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)" |
| 44 | - name: Setup new cert files |
| 45 | run: | |
| 46 | echo "Adding Intermediates" |
| 47 | echo "${{ github.event.inputs.addIntermediates }} | base64 --decode" |
| 48 | echo "Adding Roots" |
| 49 | echo "${{ github.event.inputs.addRoots }} | base64 --decode" |
| 50 | echo ${{ github.event.inputs.addIntermediates }} | base64 --decode >> ${{ runner.temp }}/new_intermediates.txt |
| 51 | echo ${{ github.event.inputs.addRoots }} | base64 --decode >> ${{ runner.temp }}/new_roots.txt |
| 52 | - name: Run release |
| 53 | run: | |
| 54 | EXPIRATION_WINDOW=${{ github.event.inputs.expirationWindow }} ALLOW_SKIP_PR=${{ github.event.inputs.allowSkipPR }} NEW_INTERMEDIATES=${{ runner.temp }}/new_intermediates.txt NEW_ROOTS=${{ runner.temp }}/new_roots.txt ./release.sh |
| 55 | echo "LATEST_RELEASE=$(cfssl-trust -d cert.db releases | awk ' NR==1 { print $2 }')" >> $GITHUB_ENV |
| 56 | echo "CREATE_PR=$(git branch --show-current | grep -q release && echo true)" >> $GITHUB_ENV |
| 57 | - name: Create pull request |
| 58 | if: ${{ env.CREATE_PR == 'true'}} |
| 59 | uses: repo-sync/pull-request@v2 |
| 60 | with: |
| 61 | source_branch: "release/${{ env.LATEST_RELEASE }}" |
| 62 | destination_branch: "master" |
| 63 | pr_reviewer: "lgarofalo,maxnystrom,mihirjham,mitalirawat,nickysemenza" |
| 64 | pr_assignee: "lgarofalo,maxnystrom,mihirjham,mitalirawat,nickysemenza" |
| 65 | github_token: ${{ secrets.GITHUB_TOKEN }} |
| 66 | |