Implement replies #1026
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: Deploy Jekyll Site | |
on: | |
push: | |
branches: | |
- staging | |
- master | |
- dp-v1-prod | |
pull_request: | |
branches: | |
- staging | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Get system info | |
- run: ifconfig | |
- run: sudo dmidecode | |
- run: df -h | |
- run: free -m | |
- run: echo "GitHub branch is ${{ github.ref }}" | |
# Conditional checkout for PRs | |
- name: Checkout PR branch | |
if: github.event_name == 'pull_request' | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
# Standard checkout for non-PR events | |
- name: Checkout repo | |
if: github.event_name != 'pull_request' | |
uses: actions/checkout@v4 | |
# Build Jekyll Site | |
- run: echo "Building Jekyll site" | |
- run: sudo gem install bundler | |
- run: sudo gem install jekyll | |
- run: sudo bundle install | |
- name: Set DP Social URL based on branch | |
run: | | |
if [[ "${{ github.ref }}" == "refs/heads/master" ]] || [[ "${{ github.event_name }}" == "pull_request" && "${{ github.base_ref }}" == "master" ]]; then | |
sed -i 's|url: "https://social.dp.chanterelle.xyz"|url: "${{ vars.SOCIAL_DP_PROD }}"|' _config.yml | |
elif [[ "${{ github.ref }}" == "refs/heads/staging" ]] || [[ "${{ github.event_name }}" == "pull_request" && "${{ github.base_ref }}" == "staging" ]]; then | |
# Replace with staging URL for activity_pub (SOCIAL_DP_STAGING) | |
sed -i 's|url: "https://social.dp.chanterelle.xyz"|url: "${{ vars.SOCIAL_DP_STAGING }}"|' _config.yml | |
fi | |
# Decode the correct key based on the branch | |
- name: Decode Staging Key | |
if: > | |
github.ref == 'refs/heads/staging' || | |
(github.event_name == 'pull_request' && github.base_ref == 'staging') | |
run: echo ${{ secrets.ENCODED_DP_AP_KEY_STAGING }} | base64 --decode > /tmp/secret.key | |
- name: Decode Production Key | |
if: > | |
github.ref == 'refs/heads/master' || | |
(github.event_name == 'pull_request' && github.base_ref == 'master') | |
run: echo ${{ secrets.ENCODED_DP_AP_KEY_PRODUCTION }} | base64 --decode > /tmp/secret.key | |
- name: Build Jekyll Site for Staging | |
if: github.ref == 'refs/heads/staging' || (github.event_name == 'pull_request' && github.base_ref == 'staging') | |
run: | | |
JEKYLL_ENV=staging make build-dweb | |
- name: Build Jekyll Site for Production | |
if: github.ref == 'refs/heads/master' || (github.event_name == 'pull_request' && github.base_ref == 'master') | |
run: | | |
make build-dweb | |
- run: make check | |
- name: Publish to Distributed Press Staging | |
if: ${{ github.ref == 'refs/heads/staging' }} | |
uses: hyphacoop/[email protected] | |
with: | |
publish_dir: _site | |
dp_url: https://dp.chanterelle.xyz | |
refresh_token: ${{ secrets.DISTRIBUTED_PRESS_STAGING_TOKEN }} | |
site_url: staging.hypha.coop | |
- name: Publish to Distributed Press Production | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: hyphacoop/[email protected] | |
with: | |
publish_dir: _site | |
dp_url: https://api.distributed.press | |
refresh_token: ${{ secrets.DISTRIBUTED_PRESS_PRODUCTION_TOKEN}} | |
site_url: hypha.coop | |
- name: Notify AP | |
run: bundle exec jekyll notify --key /tmp/secret.key --verbose --trace | |
- name: Commit ActivityPub Data | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: '_data/activity_pub.yml' | |
default_author: github_actions | |
message: 'Commit ActivityPub Data' | |
fetch: true | |