Release News Workflow #1006
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: Release News Workflow | |
on: | |
# Allow manually starting the workflow incase we need human intervention. | |
workflow_dispatch: | |
# Runs at 08:17 UTC / 00:17 PST / 01:17 PDT | |
# 17 is an arbitrarily chosen to avoid running the workflow during the peak at the beginning of the hour | |
schedule: | |
- cron: '17 8 * * *' | |
permissions: write-all | |
jobs: | |
generate_news_items: | |
# If this is running in a fork, only run if manually dispatched. | |
if: github.repository == 'amazon-ion/ion-docs' || github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Generate News Posts | |
id: generate_news | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
./_scripts/generate_release_news.sh | |
- name: Commit and Push Changes | |
if: ${{ steps.generate_news.outputs.changes > 0 }} | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git commit -m "${{ steps.generate_news.outputs.generated_commit_message }}" | |
git push | |
- name: Deploy Changes | |
if: ${{ steps.generate_news.outputs.changes > 0 }} | |
# If you use the GITHUB_TOKEN to push code, it won't trigger any on-push | |
# workflows, so we manually the workflow here. | |
# We can't just call the workflow directly because we need the workflow to run | |
# on the new commit, not the GITHUB_REF for this workflow. | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh workflow run .github/workflows/deploy.yml -R "${{ github.repository }}" |