Add Innerhelm launch announcement #644
Workflow file for this run
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: Build and Deploy to Cloudflare Pages | |
on: | |
schedule: | |
- cron: "0 15 * * *" | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
id: checkout_repo | |
uses: actions/checkout@v3 | |
- name: Determine whether to check for changed non-markdown files | |
id: determine_mode | |
run: | | |
if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" || "${{ github.event_name }}" == "pull_request" ]]; then | |
echo "mode=always" >> $GITHUB_OUTPUT | |
else | |
echo "mode=check" >> $GITHUB_OUTPUT | |
fi | |
- name: Get changed files | |
id: changed_files | |
if: steps.determine_mode.outputs.mode == 'check' | |
uses: tj-actions/changed-files@v41 | |
- name: Check for non-Markdown files | |
id: check_files | |
if: steps.determine_mode.outputs.mode == 'check' | |
run: | | |
non_markdown_files=$(echo "${{ steps.changed_files.outputs.modified_files }}" | grep -v '\.md$' || true) | |
echo "non_markdown_files=$non_markdown_files" >> $GITHUB_OUTPUT | |
- name: Build site | |
id: build_site | |
if: steps.determine_mode.outputs.mode == 'always' || steps.check_files.outputs.non_markdown_files != '' | |
run: | | |
npm install | |
npm run build | |
echo "result=built" >> $GITHUB_OUTPUT | |
- name: Extract variables | |
id: extract_vars | |
if: steps.build_site.outputs.result == 'built' | |
run: | | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
echo "datetime=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT | |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
- name: Deploy to Cloudflare Pages | |
id: deploy | |
if: steps.build_site.outputs.result == 'built' | |
uses: cloudflare/pages-action@v1 | |
with: | |
branch: ${{ steps.extract_vars.outputs.branch }} | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }} | |
directory: ./dist | |
- name: Add preview URL to pull request | |
if: github.event_name == 'pull_request' && steps.build_site.outputs.result == 'built' | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
comment_tag: deploy_preview | |
mode: recreate | |
message: | | |
## Deployed to Cloudflare Pages! :rocket: | |
| Name | Result | | |
| ----------------------- | - | | |
| **Preview URL**: | https://${{ steps.extract_vars.outputs.branch }}.${{ secrets.CLOUDFLARE_PROJECT_NAME }}.pages.dev | | |
| **Last commit:** | `${{ steps.extract_vars.outputs.sha_short }}` | | |
| **Deployed at**: | `${{ steps.extract_vars.outputs.datetime }}` | | |
# send-email: | |
# needs: build | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout repository | |
# id: checkout_repo | |
# uses: actions/checkout@v3 | |
# - name: Create .env with Github Secrets, Send email if needed | |
# if: github.event_name == 'schedule' | |
# id: send_email | |
# run: | | |
# touch .env | |
# echo SENDGRID_API_KEY=$SENDGRID_API_KEY >> .env | |
# echo SENDGRID_SEGMENT_UNCATEGORIZED=$SENDGRID_SEGMENT_UNCATEGORIZED >> .env | |
# echo SENDGRID_SEGMENT_SOFTWARE=$SENDGRID_SEGMENT_SOFTWARE >> .env | |
# echo SENDGRID_SEGMENT_FAITH=$SENDGRID_SEGMENT_FAITH >> .env | |
# echo SENDGRID_UG_UNCATEGORIZED=$SENDGRID_UG_UNCATEGORIZED >> .env | |
# echo SENDGRID_UG_SOFTWARE=$SENDGRID_UG_SOFTWARE >> .env | |
# echo SENDGRID_UG_FAITH=$SENDGRID_UG_FAITH >> .env | |
# echo SENDGRID_SENDER_ID=$SENDGRID_SENDER_ID >> .env | |
# npm install | |
# npm run send-email | |
# env: | |
# SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }} | |
# SENDGRID_SEGMENT_UNCATEGORIZED: ${{ secrets.SENDGRID_SEGMENT_UNCATEGORIZED }} | |
# SENDGRID_SEGMENT_SOFTWARE: ${{ secrets.SENDGRID_SEGMENT_SOFTWARE }} | |
# SENDGRID_SEGMENT_FAITH: ${{ secrets.SENDGRID_SEGMENT_FAITH }} | |
# SENDGRID_UG_UNCATEGORIZED: ${{ secrets.SENDGRID_UG_UNCATEGORIZED }} | |
# SENDGRID_UG_SOFTWARE: ${{ secrets.SENDGRID_UG_SOFTWARE }} | |
# SENDGRID_UG_FAITH: ${{ secrets.SENDGRID_UG_FAITH }} | |
# SENDGRID_SENDER_ID: ${{ secrets.SENDGRID_SENDER_ID }} |