-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(production-cd): add production cd and test
- Loading branch information
DrZIn-dev
committed
Apr 9, 2022
1 parent
7ff7490
commit 89b51b0
Showing
3 changed files
with
104 additions
and
2 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,102 @@ | ||
name: Production CD | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
check-file-changed: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
api_changed: ${{ steps.api-changed-files.outputs.any_changed }} | ||
todo_list_changed: ${{ steps.todo-list-changed-files.outputs.any_changed }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
- name: Get changed files | ||
id: api-changed-files | ||
uses: tj-actions/[email protected] | ||
with: | ||
since_last_remote_commit: 'true' | ||
files: | | ||
api/ | ||
- name: Get changed files | ||
id: todo-list-changed-files | ||
uses: tj-actions/[email protected] | ||
with: | ||
since_last_remote_commit: 'true' | ||
files: | | ||
todolist/ | ||
api-build-push: | ||
if: needs.check-file-changed.outputs.api_changed == 'true' | ||
needs: | ||
- check-file-changed | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./api | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Log in to GitHub Docker Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build container image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
pull: true | ||
push: true | ||
context: ./api | ||
file: ./api/Dockerfile | ||
target: production | ||
tags: | | ||
ghcr.io/drzin-dev/anodos:${{ steps.get_release.outputs.tag_name }} | ||
api-deploy: | ||
needs: | ||
- api-build-push | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo "dockerize api" | ||
- name: Install SSH Key | ||
uses: shimataro/ssh-key-action@v2 | ||
with: | ||
key: ${{ secrets.STAGING_PRIVATE_KEY }} | ||
known_hosts: "just-a-placeholder-so-we-dont-get-errors" | ||
- name: Adding Known Hosts | ||
run: ssh-keyscan -H 206.189.38.174 >> ~/.ssh/known_hosts | ||
# - name: Deploy Staging Server | ||
# run: ssh [email protected] 'cd /root/deployment && make DEPLOY_ANODOS_STAGING' | ||
|
||
todo-list-build: | ||
if: needs.check-file-changed.outputs.todo_list_changed == 'true' | ||
needs: | ||
- check-file-changed | ||
runs-on: macos-latest | ||
defaults: | ||
run: | ||
working-directory: ./todolist | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
todo-list-publish-TestFlight: | ||
if: needs.check-file-changed.outputs.todo_list_changed == 'true' | ||
needs: | ||
- todo-list-build | ||
runs-on: macos-latest | ||
defaults: | ||
run: | ||
working-directory: ./todolist | ||
steps: | ||
- uses: actions/checkout@v2 |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "api", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "", | ||
"author": "", | ||
"private": true, | ||
|