-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
2,027 additions
and
1,414 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,80 @@ | ||
name: Test server CI/CD | ||
|
||
on: | ||
push: | ||
branches: ['main', 'develop'] | ||
pull_request: | ||
branches: ['main', 'develop'] | ||
types: ['opened', 'reopened', 'synchronize', 'closed'] | ||
|
||
jobs: | ||
CI: | ||
name: Test CI!! ๐ | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout ๐ | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Check current directory | ||
run: | | ||
echo "Current directory:" | ||
pwd | ||
echo "Directory content:" | ||
ls -la | ||
- name: Change to project dic | ||
run: cd /home/runner/work/Peer-Frontend/Peer-Frontend | ||
|
||
- name: Install packages | ||
run: npm i /home/runner/work/Peer-Frontend/Peer-Frontend | ||
|
||
- name: Prettier | ||
working-directory: /home/runner/work/Peer-Frontend/Peer-Frontend | ||
run: npm run format | ||
|
||
- name: Lint | ||
working-directory: /home/runner/work/Peer-Frontend/Peer-Frontend | ||
run: npm run lint | ||
|
||
- name: Build Test | ||
working-directory: /home/runner/work/Peer-Frontend/Peer-Frontend | ||
run: npm run build | ||
|
||
CD: | ||
name: Test CD ๐ป | ||
if: github.ref == 'refs/heads/develop' && (github.event.pull_request.merged == true || github.event_name == 'push') | ||
runs-on: ubuntu-latest | ||
needs: CI | ||
steps: | ||
- name: Checkout ๐ | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build and push Docker image | ||
run: | | ||
touch /home/runner/work/Peer-Frontend/Peer-Frontend/.env.production | ||
echo "${{ secrets.ENV_FILE }}" >> /home/runner/work/Peer-Frontend/Peer-Frontend/.env.production | ||
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | ||
docker build -f Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_TEST_IMAGE }} . | ||
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_TEST_IMAGE }} | ||
- name: Deploy | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.DEV_TEST_HOST }} | ||
port: 22 | ||
username: ${{ secrets.DEV_TEST_USERNAME }} | ||
password: ${{ secrets.DEV_TEST_KEY }} | ||
script: | | ||
docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_TEST_IMAGE }} | ||
docker rm -f ${{ secrets.DOCKER_DEV_TEST_IMAGE }} | ||
docker run -d -p 3000:3000 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_TEST_IMAGE }} | ||
docker container prune -f | ||
docker image prune -f |
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.
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
Oops, something went wrong.