-
Notifications
You must be signed in to change notification settings - Fork 0
ci(pesacheck_meedan_bridge): Add continuous deployment workflow #1209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
964781a
ci(pesacheck_meedan_bridge): Add continuous deployment workflow
koechkevin 8d2db59
ci(pesacheck_meedan_bridge): Test CD workflow from this branch
koechkevin 1e14f66
ci(pesacheck_meedan_bridge): Call pants from PATH, not ./pants
koechkevin b481a55
ci(pesacheck_meedan_bridge): Deploy the built image via git:from-image
koechkevin b31ca68
fix(pesacheck_meedan_bridge): Send an identifying User-Agent to Ghost
koechkevin 481d5dd
chore(pesacheck_meedan_bridge): Bump VERSION to 0.1.20
koechkevin 727f6b1
ci(pesacheck_meedan_bridge): Drop git-push inputs from the Dokku deploy
koechkevin 093d834
ci(pesacheck_meedan_bridge): Drop branch-test triggers, bump to 0.1.21
koechkevin 3259989
ci(pesacheck_meedan_bridge): Limit GITHUB_TOKEN to contents: read
koechkevin 54f86bb
fix(pesacheck_meedan_bridge): Version the User-Agent, point it at Pes…
koechkevin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,83 @@ | ||
| # yamllint disable rule:line-length | ||
| name: PesaCheck Meedan Bridge | Continuous Deployment | ||
| "on": | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "pesacheck_meedan_bridge/py/VERSION" | ||
| # The job only checks out the repo; the deploy uses DockerHub/SSH secrets. | ||
| permissions: | ||
| contents: read | ||
| env: | ||
| DOKKU_REMOTE_URL: "ssh://dokku@dokku-1.dev.codeforafrica.org/pesacheck-meedan-bridge" | ||
| IMAGE_NAME: "codeforafrica/pesacheck_meedan_bridge" | ||
|
|
||
| # This allows a subsequently queued workflow run to interrupt previous runs | ||
| concurrency: | ||
| group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build and Deploy | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.11"] | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set env | ||
| run: echo "VERSION=$(cat pesacheck_meedan_bridge/py/VERSION)" >> $GITHUB_ENV | ||
|
|
||
| - name: Setup Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Initialize Pants | ||
| uses: pantsbuild/actions/init-pants@main | ||
| with: | ||
| # cache0 makes it easy to bust the cache if needed | ||
| gha-cache-key: cache0-py${{ matrix.python_version }} | ||
| named-caches-hash: ${{ hashFiles('lockfiles/*.json', '**/something-else.lock') }} | ||
|
|
||
| - name: Bootstrap Pants | ||
| run: | | ||
| pants --version | ||
|
|
||
| - name: Check BUILD files | ||
| run: pants tailor --check update-build-files --check | ||
|
|
||
| - name: Lint | ||
| run: | | ||
| pants lint --lint-skip-formatters pesacheck_meedan_bridge/:: | ||
|
|
||
| - name: Build Docker image | ||
| run: | | ||
| VERSION=${{ env.VERSION }} pants package pesacheck_meedan_bridge/docker/:: | ||
|
|
||
| - name: Login to DockerHub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
|
||
| - name: Push to DockerHub | ||
| run: | | ||
| docker push ${{ env.IMAGE_NAME }}:${{ env.VERSION }} | ||
|
|
||
| - name: Deploy to Dokku | ||
| uses: dokku/github-action@v1.9.0 | ||
| with: | ||
| # With deploy_docker_image the action runs `dokku git:from-image` and | ||
| # never pushes a branch, so `branch`/`git_push_flags` don't apply. | ||
| deploy_docker_image: ${{ env.IMAGE_NAME }}:${{ env.VERSION }} | ||
| deploy_user_name: "CodeForAfrica Bot" | ||
| deploy_user_email: "support@codeforafrica.org" | ||
| git_remote_url: ${{ env.DOKKU_REMOTE_URL }} | ||
| ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -1 +1 @@ | ||
| 0.1.18 | ||
| 0.1.21 |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.