Last active
May 6, 2020 03:11
-
-
Save justinyoo/b1793b9fe678641de6308b956c3d77d1 to your computer and use it in GitHub Desktop.
Publishing JAM Stack Web Apps with GitOps and GitHub Actions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull Request | |
on: | |
pull_request: | |
branches: | |
- dev | |
types: | |
- opened | |
jobs: | |
schedule_publish: | |
name: Schedule publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check event payload | |
shell: bash | |
run: | | |
echo ${{ toJSON(github.event) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Check pr body | |
id: prbody | |
shell: bash | |
run: | | |
echo ::set-output name=published::$(echo ${{ toJSON(github.event.pull_request.body) }} | sed 's!published: !!g' | sed 's!\\r\\n!!g') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Check environment variables | |
shell: bash | |
run: | | |
echo "Published: ${{ steps.prbody.outputs.published }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Schedule publish | |
shell: bash | |
run: | | |
curl -X POST 'https://${{ secrets.AZURE_FUNCTIONS_NAME }}.azurewebsites.net/api/orchestrators/schedule-event' \ | |
-d '{ "owner": "aliencube", "repository": "blog", "issueId": ${{ github.event.pull_request.number }}, "schedule": "${{ steps.prbody.outputs.published }}" }} }' \ | |
-H "x-functions-key: ${{ secrets.AZURE_FUNCTIONS_KEY }}" \ | |
-H "Content-Type: application/json" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment