another #564
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
# Note that the deploy steps expect that backend/Cargo.toml and deploys/k8s/server_external.yaml | |
# have the same version number. | |
name: Server CI/CD | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_call: | |
secrets: | |
DOCKERHUB_USERNAME: | |
description: 'DockerHub username for CD' | |
required: true | |
DOCKERHUB_TOKEN: | |
description: 'DockerHub access token for CD' | |
required: true | |
DIGITALOCEAN_ACCESS_TOKEN: | |
description: 'DigitalOcean access token for CD' | |
required: true | |
CLOUDFLARE_TOKEN: | |
description: 'Cloudflare API token for CD' | |
required: true | |
CLOUDFLARE_ZONE_JONLINEIO: | |
description: 'Cloudflare Zone ID for Jonline.io' | |
required: true | |
CLOUDFLARE_ZONE_BULLCITY_SOCIAL: | |
description: 'Cloudflare Zone ID for Bull City Social' | |
required: true | |
CLOUDFLARE_ZONE_OAKCITY_SOCIAL: | |
description: 'Cloudflare Zone ID for Oak City Social' | |
required: true | |
jobs: | |
test_consistency: | |
name: Test Proto/Docs Consistency | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: arduino/setup-protoc@v3 | |
with: | |
version: "26.x" | |
- uses: ts-graphviz/setup-graphviz@v2 | |
- uses: subosito/flutter-action@v2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- run: npm install --global yarn | |
- name: Get yarn cache directory path | |
working-directory: frontends/tamagui | |
id: yarn-cache-dir-path | |
run: 'echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT' | |
- uses: actions/cache@v4 | |
# id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: jonline-consistency-test-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
jonline-consistency-test-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- working-directory: frontends/tamagui | |
run: yarn install | |
- working-directory: frontends/tamagui | |
run: yarn version:install | |
- name: Build Markdown & HTML docs | |
# run: make documentation html_docs | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 3 | |
max_attempts: 3 | |
command: make documentation html_docs | |
# TODO: GraphViz versions produce different diagram outputs. | |
# My local Homebrew version is 9.0.0 (20230911.1827), | |
# GitHub Actions is 2.43.0 (0) | |
# - name: Build Graphviz diagrams | |
# run: make graphs | |
- name: Build Protos | |
run: make protos | |
- name: Check for changes | |
run: git diff --exit-code --ignore-matching-lines='// protoc +v[\\.0-9]+' | |
build_flutter_ui: | |
name: Build Flutter Web UI | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract Versioning Data | |
id: vars | |
run: |- | |
echo "be_version=$(cat backend/Cargo.toml | grep 'version =' | sed -n 1p | awk '{print $3;}' | sed 's/"//g')" >> $GITHUB_OUTPUT | |
echo "sha_short=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT | |
- name: Store Versioning Data for release ${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
run: echo ${{ steps.vars.outputs.sha_short }} > deploys/docker/continuous_delivery_hash | |
- uses: subosito/flutter-action@v2 | |
- working-directory: frontends/flutter | |
run: flutter pub get | |
# - working-directory: frontends/flutter | |
# run: flutter test | |
- working-directory: frontends/flutter | |
run: flutter build web --web-renderer canvaskit --release --base-href /flutter/ | |
- uses: actions/cache/save@v4 | |
id: flutter-app-cache | |
with: | |
path: frontends/flutter/build/web | |
key: flutter-${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
build_tamagui_ui: | |
name: Build Tamagui Web UI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract Versioning Data | |
id: vars | |
run: |- | |
echo "be_version=$(cat backend/Cargo.toml | grep 'version =' | sed -n 1p | awk '{print $3;}' | sed 's/"//g')" >> $GITHUB_OUTPUT | |
echo "sha_short=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT | |
- name: Store Versioning Data for release ${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
run: echo ${{ steps.vars.outputs.sha_short }} > deploys/docker/continuous_delivery_hash | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- run: npm install --global yarn | |
- name: Get yarn cache directory path | |
working-directory: frontends/tamagui | |
id: yarn-cache-dir-path | |
run: 'echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT' | |
- uses: actions/cache@v4 | |
# id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: jonline-tamagui-build-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
jonline-tamagui-build-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- working-directory: frontends/tamagui | |
run: yarn install | |
- working-directory: frontends/tamagui | |
run: yarn version:install | |
- working-directory: frontends/tamagui | |
run: yarn tsc | |
- working-directory: frontends/tamagui | |
run: yarn web:prod:build | |
- uses: actions/cache/save@v4 | |
id: web-app-cache | |
with: | |
path: frontends/tamagui/apps/next/out | |
key: web-${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
build_rust_binaries: | |
name: Build Rust Binaries | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract Versioning Data | |
id: vars | |
run: |- | |
echo "be_version=$(cat backend/Cargo.toml | grep 'version =' | sed -n 1p | awk '{print $3;}' | sed 's/"//g')" >> $GITHUB_OUTPUT | |
echo "sha_short=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT | |
- name: Store Versioning Data for release ${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
run: echo ${{ steps.vars.outputs.sha_short }} > deploys/docker/continuous_delivery_hash | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: arduino/setup-protoc@v3 | |
with: | |
version: "26.x" | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: ./backend -> target | |
# default key | |
key: jonline-build-${{ runner.OS }}-github-build | |
shared-key: jonline-build-${{ runner.OS }}-github-build | |
- working-directory: backend | |
run: cargo build --release | |
- uses: actions/cache/save@v4 | |
id: rust-app-cache | |
with: | |
path: backend/target/release | |
key: rust-${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
test_rust_binaries: | |
name: Test Rust Binaries | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: arduino/setup-protoc@v3 | |
with: | |
version: "26.x" | |
# - run: sudo apt install libprotobuf-dev protobuf-compiler | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: ./backend -> target | |
# default key | |
key: jonline-test-${{ runner.OS }}-github-test | |
shared-key: jonline-test-${{ runner.OS }}-github-test | |
- working-directory: backend | |
run: cargo test --all-features | |
- working-directory: backend | |
run: cargo build --all-features | |
test_tamagui_ui: | |
name: Test Tamagui Web UI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- run: npm install --global yarn | |
- name: Get yarn cache directory path | |
working-directory: frontends/tamagui | |
id: yarn-cache-dir-path | |
run: 'echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT' | |
- uses: actions/cache@v4 | |
# id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: jonline-tamagui-test-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
jonline-tamagui-test-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- working-directory: frontends/tamagui | |
run: yarn install | |
- working-directory: frontends/tamagui | |
run: yarn version:install | |
- working-directory: frontends/tamagui | |
run: yarn build | |
- working-directory: frontends/tamagui | |
run: yarn tsc | |
test_flutter_ui: | |
name: Test Flutter Web UI | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
- working-directory: frontends/flutter | |
run: flutter pub get | |
- working-directory: frontends/flutter | |
run: flutter test | |
- working-directory: frontends/flutter | |
run: flutter build web | |
push_server: | |
name: 'DockerHub: Server' | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: | |
- build_flutter_ui | |
- build_tamagui_ui | |
- build_rust_binaries | |
- test_consistency | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract Versioning Data | |
id: vars | |
run: |- | |
echo "be_version=$(cat backend/Cargo.toml | grep 'version =' | sed -n 1p | awk '{print $3;}' | sed 's/"//g')" >> $GITHUB_OUTPUT | |
echo "sha_short=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT | |
- name: Store Versioning Data for release ${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
run: echo ${{ steps.vars.outputs.sha_short }} > deploys/docker/continuous_delivery_hash | |
- uses: actions/cache/restore@v4 | |
id: flutter-app-cache | |
continue-on-error: true | |
with: | |
path: frontends/flutter/build/web | |
key: flutter-${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
- uses: actions/cache/restore@v4 | |
id: web-app-cache | |
with: | |
path: frontends/tamagui/apps/next/out | |
key: web-${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
- uses: actions/cache/restore@v4 | |
id: rust-app-cache | |
with: | |
path: backend/target/release | |
key: rust-${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Rename Rust binaries for Dockerfiles | |
run: >- | |
mv backend/target/release/jonline backend/target/release/jonline__server_release && | |
mv backend/target/release/disable_cdn_grpc backend/target/release/disable_cdn_grpc__server_release && | |
mv backend/target/release/delete_expired_tokens backend/target/release/delete_expired_tokens__server_release && | |
mv backend/target/release/delete_unowned_media backend/target/release/delete_unowned_media__server_release && | |
mv backend/target/release/generate_preview_images backend/target/release/generate_preview_images__server_release && | |
mv backend/target/release/delete_preview_images backend/target/release/delete_preview_images__server_release && | |
mv backend/target/release/set_permission backend/target/release/set_permission__server_release && | |
mv backend/target/release/to_db_id backend/target/release/to_db_id__server_release && | |
mv backend/target/release/to_proto_id backend/target/release/to_proto_id__server_release | |
- name: Build and push jonline image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/jonline:${{ steps.vars.outputs.be_version }},${{ secrets.DOCKERHUB_USERNAME }}/jonline:${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
context: . | |
file: ./deploys/docker/server/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push_preview_generator: | |
name: 'DockerHub: Preview Generator' | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: | |
- build_rust_binaries | |
- test_consistency | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract Versioning Data | |
id: vars | |
run: |- | |
echo "be_version=$(cat backend/Cargo.toml | grep 'version =' | sed -n 1p | awk '{print $3;}' | sed 's/"//g')" >> $GITHUB_OUTPUT | |
echo "sha_short=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT | |
- name: Store Versioning Data for release ${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
run: echo ${{ steps.vars.outputs.sha_short }} > deploys/docker/continuous_delivery_hash | |
- uses: actions/cache/restore@v4 | |
id: rust-app-cache | |
with: | |
path: backend/target/release | |
key: rust-${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Rename Rust binaries for Dockerfiles | |
run: >- | |
mv backend/target/release/jonline backend/target/release/jonline__server_release && | |
mv backend/target/release/disable_cdn_grpc backend/target/release/disable_cdn_grpc__server_release && | |
mv backend/target/release/delete_expired_tokens backend/target/release/delete_expired_tokens__server_release && | |
mv backend/target/release/delete_unowned_media backend/target/release/delete_unowned_media__server_release && | |
mv backend/target/release/generate_preview_images backend/target/release/generate_preview_images__server_release && | |
mv backend/target/release/delete_preview_images backend/target/release/delete_preview_images__server_release && | |
mv backend/target/release/set_permission backend/target/release/set_permission__server_release | |
- name: Build and push jonline_preview_generator image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/jonline_preview_generator:${{ steps.vars.outputs.be_version }},${{ secrets.DOCKERHUB_USERNAME }}/jonline_preview_generator:${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
context: . | |
file: ./deploys/docker/preview_generator/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
deploy_jonlineio_server: | |
name: Deploy Jonline.io Server | |
if: github.ref == 'refs/heads/main' | |
needs: | |
- test_rust_binaries | |
- test_flutter_ui | |
- test_tamagui_ui | |
- push_server | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract Versioning Data | |
id: vars | |
run: |- | |
echo "be_version=$(cat backend/Cargo.toml | grep 'version =' | sed -n 1p | awk '{print $3;}' | sed 's/"//g')" >> $GITHUB_OUTPUT | |
echo "sha_short=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT | |
- uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | |
- name: Update deploys/k8s/server_external.yaml to use ${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
run: sed -i 's|${{ steps.vars.outputs.be_version }}|${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }}|g' deploys/k8s/server_external.yaml | |
- name: Save DigitalOcean kubeconfig with short-lived credentials | |
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 jonline-be | |
# If you haven't already integrated with your registry and only want workloads in a particular namespace to be able to pull | |
# from your registry, uncomment the next two commands. | |
# - name: Upload credentials of your registry to your DigitalOcean Kubernetes cluster | |
# run: doctl registry kubernetes-manifest | kubectl apply -f - | |
# - name: Reference the secret you just uploaded as an imagePullSecrets | |
# run: "kubectl patch serviceaccount default -p '{\"imagePullSecrets\": [{\"name\": \"registry-<your-registry-name>`\"}]}'" | |
- name: Deploy to Jonline.io via DigitalOcean Kubernetes | |
run: kubectl apply -f deploys/k8s/server_external.yaml -n jonline | |
- name: Verify Server deployment | |
run: kubectl rollout status deployment/jonline -n jonline --timeout 2m | |
- name: Purge Cloudflare cache | |
uses: jakejarvis/cloudflare-purge-action@master | |
env: | |
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE_JONLINEIO }} | |
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} | |
deploy_jonlineio_preview_generator: | |
name: Deploy Jonline.io Preview Generator | |
if: github.ref == 'refs/heads/main' | |
needs: | |
- test_rust_binaries | |
- push_preview_generator | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract Versioning Data | |
id: vars | |
run: |- | |
echo "be_version=$(cat backend/Cargo.toml | grep 'version =' | sed -n 1p | awk '{print $3;}' | sed 's/"//g')" >> $GITHUB_OUTPUT | |
echo "sha_short=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT | |
- uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | |
- name: Update deploys/k8s/preview_generator.yaml to use ${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
run: sed -i 's|${{ steps.vars.outputs.be_version }}|${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }}|g' deploys/k8s/preview_generator.yaml | |
- name: Save DigitalOcean kubeconfig with short-lived credentials | |
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 jonline-be | |
- name: Deploy to Jonline.io via DigitalOcean Kubernetes | |
run: kubectl apply -f deploys/k8s/preview_generator.yaml -n jonline | |
- name: Purge Cloudflare cache | |
uses: jakejarvis/cloudflare-purge-action@master | |
env: | |
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE_JONLINEIO }} | |
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} | |
create_github_release: | |
name: 'GitHub: Release' | |
# permissions: write-all | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: | |
- deploy_jonlineio_server | |
- deploy_jonlineio_preview_generator | |
- push_server | |
- push_preview_generator | |
- test_consistency | |
- test_rust_binaries | |
- test_flutter_ui | |
- test_tamagui_ui | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Extract Versioning Data | |
id: vars | |
run: |- | |
be_version="$(cat backend/Cargo.toml | grep 'version =' | sed -n 1p | awk '{print $3;}' | sed 's/\"//g')" | |
sha_short="$(git rev-parse --short=7 HEAD)" | |
echo "be_version=${be_version}" >> $GITHUB_OUTPUT | |
echo "sha_short=${sha_short}" >> $GITHUB_OUTPUT | |
echo "full_version=${be_version}-${sha_short}" >> $GITHUB_OUTPUT | |
- name: Store Versioning Data for release ${{ steps.vars.outputs.full_version }} | |
run: echo ${{ steps.vars.outputs.sha_short }} > deploys/docker/continuous_delivery_hash | |
- name: Push tag v${{ steps.vars.outputs.full_version }} | |
uses: mathieudutour/github-tag-action@v6.2 | |
with: | |
custom_tag: "${{ steps.vars.outputs.full_version }}" | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Changelog | |
id: changelog | |
run: | | |
delimiter="$(openssl rand -hex 32)" | |
echo "ci_changelog<<${delimiter}" >> $GITHUB_OUTPUT | |
echo "$(git --no-pager log -10 --pretty='- [`%h` / *%ch*] %B')" >> $GITHUB_OUTPUT | |
echo "${delimiter}" >> $GITHUB_OUTPUT | |
- name: Display Changelog (for debugging the CI/CD process) | |
run: | | |
echo "The string is: \n${{ steps.changelog.outputs.ci_changelog }}" | |
- name: Create release v${{ steps.vars.outputs.full_version }} | |
uses: ncipollo/release-action@v1 | |
with: | |
name: "v${{ steps.vars.outputs.full_version }} (CI/CD)" | |
tag: "v${{ steps.vars.outputs.full_version }}" | |
makeLatest: true | |
body: |- | |
# Jonline CI/CD Release | |
### `v${{ steps.vars.outputs.full_version }}` | |
Built by the [Server CI/CD GitHub Action ](https://github.com/jonlatane/jonline/actions/workflows/server_ci_cd.yml). | |
Images are available on DockerHub: | |
- [DockerHub: Jonline Server (jonlatane/jonline:${{ steps.vars.outputs.full_version }})](https://hub.docker.com/r/jonlatane/jonline/tags?page=1&name=${{ steps.vars.outputs.full_version }}) | |
- [DockerHub: Jonline Preview Generator (jonlatane/jonline_preview_generator:${{ steps.vars.outputs.full_version }})](https://hub.docker.com/r/jonlatane/jonline_preview_generator/tags?page=1&name=${{ steps.vars.outputs.full_version }}) | |
- *In testing/not yet ready for production use:* [DockerHub: JBL (Jonline Balancer of Loads/Load Balancer) (jonlatane/jbl:${{ steps.vars.outputs.full_version }})](https://hub.docker.com/r/jonlatane/jonline_preview_generator/tags?page=1&name=${{ steps.vars.outputs.full_version }}) | |
## Deployments | |
Deployments will be brought up-to-date at around the same time as this release is created. | |
First, Jonline.io (and any other "development" deployments) will be updated. | |
Then, this release is created (so, Jonline.io should already be updated). | |
Finally, Bull City Social and Oak City Social (and any other "production" deployments) will be updated. | |
| Deployment | Links | Deployment Version | | |
| --- | --- | --- | | |
| [Jonline.io ](https://jonline.io) | [About](https://jonline.io/about), [Protocol Docs](https://jonline.io/docs/protocol/) | Development | | |
| [BullCity.Social ](https://BullCity.Social/) | [About](https://BullCity.Social/about), [Protocol Docs](https://BullCity.Social/docs/protocol/) | Production | | |
| [OakCity.Social ](https://OakCity.Social/) | [About](https://OakCity.Social/about), [Protocol Docs](https://OakCity.Social/docs/protocol/) | Production | | |
## Changelog | |
This list's Markdown was generated with `git log -100 --pretty='- [%h / *%ch*] %B'` at release time: | |
${{ steps.changelog.outputs.ci_changelog }} | |
deploy_bullcitysocial: | |
name: Deploy Bull City Social | |
needs: create_github_release | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract Versioning Data | |
id: vars | |
run: |- | |
echo "be_version=$(cat backend/Cargo.toml | grep 'version =' | sed -n 1p | awk '{print $3;}' | sed 's/"//g')" >> $GITHUB_OUTPUT | |
echo "sha_short=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT | |
- uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | |
- name: Update deploys/k8s/server_external.yaml to use ${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
run: sed -i 's|${{ steps.vars.outputs.be_version }}|${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }}|g' deploys/k8s/server_external.yaml | |
- name: Update deploys/k8s/preview_generator.yaml to use ${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
run: sed -i 's|${{ steps.vars.outputs.be_version }}|${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }}|g' deploys/k8s/preview_generator.yaml | |
- name: Save DigitalOcean kubeconfig with short-lived credentials | |
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 jonline-be | |
- name: Deploy to Bull City Social via DigitalOcean Kubernetes | |
run: kubectl apply -f deploys/k8s/server_external.yaml -n bullcitysocial | |
- name: Verify Server deployment | |
run: kubectl rollout status deployment/jonline -n bullcitysocial --timeout 2m | |
- name: Deploy Preview Generator | |
run: kubectl apply -f deploys/k8s/preview_generator.yaml -n bullcitysocial | |
- name: Purge Cloudflare cache | |
uses: jakejarvis/cloudflare-purge-action@master | |
env: | |
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE_BULLCITY_SOCIAL }} | |
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} | |
deploy_oakcitysocial: | |
name: Deploy Oak City Social | |
needs: create_github_release | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract Versioning Data | |
id: vars | |
run: |- | |
echo "be_version=$(cat backend/Cargo.toml | grep 'version =' | sed -n 1p | awk '{print $3;}' | sed 's/"//g')" >> $GITHUB_OUTPUT | |
echo "sha_short=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT | |
- uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | |
- name: Update deploys/k8s/server_external.yaml to use ${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
run: sed -i 's|${{ steps.vars.outputs.be_version }}|${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }}|g' deploys/k8s/server_external.yaml | |
- name: Update deploys/k8s/preview_generator.yaml to use ${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }} | |
run: sed -i 's|${{ steps.vars.outputs.be_version }}|${{ steps.vars.outputs.be_version }}-${{ steps.vars.outputs.sha_short }}|g' deploys/k8s/preview_generator.yaml | |
- name: Save DigitalOcean kubeconfig with short-lived credentials | |
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 jonline-be | |
- name: Deploy to Oak City Social via DigitalOcean Kubernetes | |
run: kubectl apply -f deploys/k8s/server_external.yaml -n oakcitysocial | |
- name: Verify Server deployment | |
run: kubectl rollout status deployment/jonline -n oakcitysocial --timeout 2m | |
- name: Deploy Preview Generator | |
run: kubectl apply -f deploys/k8s/preview_generator.yaml -n oakcitysocial | |
- name: Purge Cloudflare cache | |
uses: jakejarvis/cloudflare-purge-action@master | |
env: | |
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE_OAKCITY_SOCIAL }} | |
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} |