-
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.
- Loading branch information
1 parent
62bcafb
commit c7656f0
Showing
135 changed files
with
30,440 additions
and
8,253 deletions.
There are no files selected for viewing
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Deploy | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
deploy: | ||
if: github.event.pull_request.merged == true || github.ref_name == 'master' | ||
runs-on: ubuntu-latest | ||
env: | ||
TARGET: ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_HOST }} | ||
KEY: /tmp/private-key | ||
DIR: ~/motsflex | ||
DICOS: ~/dicos | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: "develop" | ||
- name: Setup ssh | ||
run: | | ||
mkdir -p ~/.ssh/ && touch ~/.ssh/known_hosts | ||
ssh-keyscan ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts | ||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > $KEY | ||
chmod 600 $KEY | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "18" | ||
|
||
- name: Determine Deployment Type | ||
if: ${{ success() }} | ||
run: | | ||
echo "DEPLOY_ASSETS=${{ contains(toJson(github.event.pull_request.labels.*.name), 'deploy:assets') }}" >> $GITHUB_ENV | ||
echo "DEPLOY_SERVER=${{ contains(toJson(github.event.pull_request.labels.*.name), 'deploy:server') }}" >> $GITHUB_ENV | ||
echo "DEPLOY_CLIENT=${{ contains(toJson(github.event.pull_request.labels.*.name), 'deploy:client') }}" >> $GITHUB_ENV | ||
echo "PUBLIC=$DIR/public" >> $GITHUB_ENV | ||
echo "SERVER=${{ env.DIR }}/server.js" >> $GITHUB_ENV | ||
echo "ASSETS=${{ env.DIR }}/public/assets" >> $GITHUB_ENV | ||
echo "INDEX_HTML=${{ env.DIR }}/public/index.html" >> $GITHUB_ENV | ||
if [[ $DEPLOY_ASSETS == 'false' && $DEPLOY_SERVER == 'false' && $DEPLOY_CLIENT == 'false' ]]; then | ||
exit 1; | ||
fi | ||
- name: Install Dependencies | ||
if: ${{ success() }} | ||
run: npm ci | ||
|
||
- name: Build | ||
if: ${{ success() }} | ||
run: npm run build | ||
|
||
- name: Deploy | ||
if: ${{ success() }} | ||
run: | | ||
if [ "$DEPLOY_ASSETS" = 'true' ]; then | ||
echo "Deploying JS assets" | ||
ssh -i $KEY $TARGET "rm -rf $ASSETS && mkdir -p $ASSETS" | ||
scp -i $KEY -r dist/public/assets/* "$TARGET:$ASSETS" | ||
scp -i $KEY -r dist/public/index.html "$TARGET:$INDEX_HTML" | ||
fi | ||
if [ "$DEPLOY_CLIENT" = 'true' ]; then | ||
echo "Deploying full client" | ||
ssh -i $KEY $TARGET "rm -rf $PUBLIC && mkdir -p $PUBLIC" | ||
scp -i $KEY -r dist/public/* "$TARGET:$PUBLIC" | ||
ssh -i $KEY $TARGET "cp $DICOS/*.zip $PUBLIC/assets" | ||
fi | ||
if [ "$DEPLOY_SERVER" = 'true' ]; then | ||
echo "Deploying server code" | ||
scp -i $KEY -r dist/server.js "$TARGET:$SERVER" | ||
fi | ||
- name: Cleanup | ||
run: "rm -f $KEY && rm -rf ~/.ssh" |
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,29 @@ | ||
name: Deploy | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the master branch | ||
push: | ||
branches: [ develop ] | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- name: Deploy using ssh | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SERVER_HOST }} | ||
username: ${{ secrets.SERVER_USERNAME }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
port: 22 | ||
script: | | ||
cd /tmp/mots-fleches | ||
git pull origin develop | ||
git status | ||
npm install |
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.