-
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 #899 from CodeForAfrica/ft/techlabblog-workflow
Techlab Blog Deploy
- Loading branch information
Showing
9 changed files
with
251 additions
and
22 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,70 @@ | ||
name: Build Docker Image | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
tags: | ||
required: true | ||
type: string | ||
description: "The tags to use for the Docker image" | ||
target: | ||
required: true | ||
type: string | ||
description: "The target to use for the Docker image" | ||
build_args: | ||
required: true | ||
type: string | ||
description: "The build args to use for the Docker image" | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
node-version: [20.16] | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v4 | ||
with: | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
path: /tmp/.buildx-cache | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
|
||
- name: Build Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
build-args: | | ||
${{ inputs.build_args }} | ||
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} | ||
SENTRY_ORG=${{ vars.SENTRY_ORG }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
context: . | ||
target: ${{ inputs.target }} | ||
push: true | ||
tags: ${{ inputs.tags }} | ||
|
||
# Temp fix | ||
# https://github.com/docker/build-push-action/issues/252 | ||
# https://github.com/moby/buildkit/issues/1896 | ||
- name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
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,25 @@ | ||
name: Push to Dokku | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
git_remote_url: | ||
required: true | ||
type: string | ||
description: "The remote URL to push to" | ||
deploy_docker_image: | ||
required: true | ||
type: string | ||
description: "The name of the image to push" | ||
|
||
jobs: | ||
push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Push | ||
uses: dokku/[email protected] | ||
with: | ||
git_remote_url: ${{ inputs.git_remote_url }} | ||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
deploy_docker_image: ${{ inputs.deploy_docker_image }} |
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,35 @@ | ||
name: Techlab Blog | Dev | Deploy | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- "apps/techlabblog/**" | ||
- "Dockerfile" | ||
- ".github/workflows/techlabblog-deploy-dev.yml" | ||
|
||
# This allows a subsequently queued workflow run to interrupt previous runs | ||
concurrency: | ||
group: "${{ github.workflow }} @ ${{ github.ref }}" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-docker-image: | ||
name: Build Docker Image | ||
uses: ./.github/workflows/build-docker-image.yml | ||
secrets: inherit | ||
with: | ||
tags: "codeforafrica/techlabblog:${{ github.sha }}" | ||
target: "techlabblog-runner" | ||
build_args: | | ||
SENTRY_ENVIRONMENT=development | ||
SENTRY_DSN: ${{ vars.TECHLABBLOG_SENTRY_DSN }} | ||
push-to-dokku: | ||
name: Push to Dokku | ||
needs: [build-docker-image] | ||
uses: ./.github/workflows/push-to-dokku.yml | ||
secrets: inherit | ||
with: | ||
git_remote_url: "ssh://[email protected]/techlabblog-ui" | ||
deploy_docker_image: "codeforafrica/techlabblog:${{ github.sha }}" |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.