-
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
1 changed file
with
63 additions
and
0 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,63 @@ | ||
name: Deploy Nginx with bash file | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'disabled-main' | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
pull_request: | ||
branches: | ||
- 'disabled-main' | ||
workflow_dispatch: | ||
|
||
env: | ||
SITE_URL: 'https://nemanjamitic.com' | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Print commit id, message and tag | ||
run: | | ||
git show -s --format='%h %s' | ||
echo "github.ref -> {{ github.ref }}" | ||
- name: Set up Node.js and Yarn | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.12.2' | ||
registry-url: 'https://registry.yarnpkg.com' | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build nemanjamiticcom | ||
run: yarn build | ||
|
||
- name: Set up SSH config | ||
run: | | ||
# Set up SSH key | ||
mkdir -p ~/.ssh | ||
echo "${{ secrets.REMOTE_KEY_ED25519 }}" > ~/.ssh/id_ed25519 | ||
chmod 600 ~/.ssh/id_ed25519 | ||
# Set up SSH config | ||
echo "Host arm1" > ~/.ssh/config | ||
echo " HostName ${{ secrets.REMOTE_HOST }}" >> ~/.ssh/config | ||
echo " User ${{ secrets.REMOTE_USERNAME }}" >> ~/.ssh/config | ||
echo " IdentityFile ~/.ssh/id_ed25519" >> ~/.ssh/config | ||
echo " Port ${{ secrets.REMOTE_PORT }}" >> ~/.ssh/config | ||
chmod 600 ~/.ssh/config | ||
# Add SSH server key to known_hosts | ||
ssh-keyscan -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts | ||
- name: Run bash file with yarn | ||
run: yarn deploy:nginx |