-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #828 from CodeForAfrica/feat/civicsignalblog
@/civicsignalblog
- Loading branch information
Showing
398 changed files
with
17,978 additions
and
44 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: CivicSignal Blog | Deploy | PROD | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
# This allows a subsequently queued workflow run to interrupt previous runs | ||
concurrency: | ||
group: "${{ github.workflow }} @ ${{ github.ref }}" | ||
cancel-in-progress: true | ||
|
||
env: | ||
DOKKU_REMOTE_BRANCH: "master" | ||
DOKKU_REMOTE_URL: "ssh://[email protected]/civicsignalblog-ui" | ||
GIT_PUSH_FLAGS: "--force" | ||
IMAGE_NAME: "codeforafrica/civicsignalblog-ui" | ||
VERSION_FILE_NAME: "./apps/civisignalblog/package.json" | ||
NEXT_PUBLIC_APP_URL: "https://blog.civicsignal.africa" | ||
SENTRY_ENVIRONMENT: "production" | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
node-version: [20.16] | ||
os: [ubuntu-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# Set up Node since it's required by version-check | ||
# https://github.com/EndBug/version-check#github-workflow | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Check if version is bumped | ||
id: version-check | ||
uses: EndBug/version-check@v2 | ||
with: | ||
# Whether to search in every commit's diff. | ||
# This is useful if you often do change the version without saying it | ||
# in the commit message. If you always include the semver of the new | ||
# version in your commit message when you bump versions then you can | ||
# omit this. | ||
diff-search: true | ||
file-name: "${{ env.VERSION_FILE_NAME }}" | ||
|
||
- name: Set up Docker Buildx | ||
if: steps.version-check.outputs.changed == 'true' | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Cache Docker layers | ||
if: steps.version-check.outputs.changed == 'true' | ||
uses: actions/cache@v4 | ||
with: | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
path: /tmp/.buildx-cache | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to DockerHub | ||
if: steps.version-check.outputs.changed == 'true' | ||
uses: docker/login-action@v3 | ||
with: | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
|
||
- name: Build Docker image | ||
if: steps.version-check.outputs.changed == 'true' | ||
uses: docker/build-push-action@v5 | ||
with: | ||
build-args: | | ||
MONGODB_URL=${{ secrets.CIVICSIGNALBLOG_MONGO_URL }} | ||
NEXT_PUBLIC_APP_URL=${{ env.NEXT_PUBLIC_APP_URL }} | ||
PAYLOAD_SECRET=${{ secrets.CIVICSIGNALBLOG_PAYLOAD_SECRET }} | ||
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} | ||
SENTRY_ENVIRONMENT=${{ env.SENTRY_ENVIRONMENT }} | ||
SENTRY_ORG=${{ secrets.SENTRY_ORG }} | ||
SENTRY_PROJECT=${{ secrets.CIVICSIGNALBLOG_SENTRY_PROJECT }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
context: . | ||
target: civicsignalblog-runner | ||
push: true | ||
tags: "${{ env.IMAGE_NAME }}:${{ steps.version-check.outputs.version }}" | ||
|
||
- name: Move cache | ||
if: steps.version-check.outputs.changed == 'true' | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||
- name: Push to Dokku | ||
if: steps.version-check.outputs.changed == 'true' | ||
uses: dokku/[email protected] | ||
with: | ||
deploy_docker_image: ${{ env.IMAGE_NAME }}:${{ steps.version-check.outputs.version }} | ||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
git_remote_url: ${{ env.DOKKU_REMOTE_URL }} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
MIGRATIONS_DIR=./migrations | ||
NEXT_PUBLIC_APP_DIRECTORY="apps/civicsignal/" | ||
NEXT_PUBLIC_APP_NAME="Code for Africa" | ||
NEXT_PUBLIC_APP_URL="https://blog.civicsignal.africa" | ||
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID="G-NXX5DBEHXC" | ||
NEXT_PUBLIC_IMAGE_DOMAINS="" | ||
NEXT_PUBLIC_IMAGE_UNOPTIMIZED="true" | ||
NEXT_PUBLIC_VERCEL_URL=${VERCEL_URL} | ||
SENTRY_ENVIRONMENT=local | ||
SENTRY_ORG=code-for-africa | ||
SENTRY_PROJECT=civicsignal |
Oops, something went wrong.