Skip to content

Merge pull request #1 from zurnov/Feature-Change-Donate-page #178

Merge pull request #1 from zurnov/Feature-Change-Donate-page

Merge pull request #1 from zurnov/Feature-Change-Donate-page #178

Workflow file for this run

name: publish
on:
push:
branches:
- main
env:
REGISTRY: ghcr.io
IMAGE_NAME: bitcoin-insights-frontend:latest
jobs:
build:
name: build angular app
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Dependencies
run: npm install
- name: Build Angular App
run: npm run build --prod
publish:
name: Publish Docker Image
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Login to Docker Registry
run: |
echo ${{ secrets.PAT }} | docker login ghcr.io -u zurnov --password-stdin
- name: Build Docker Image
run: |
docker build . --tag ${{ env.REGISTRY }}/zurnov/${{ env.IMAGE_NAME }}
- name: Push Docker Image
run: |
docker push ${{ env.REGISTRY }}/zurnov/${{ env.IMAGE_NAME }}
deploy:
name: Deploy Docker Image
runs-on: ubuntu-latest
needs: publish
steps:
- name: install ssh keys
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SSH_HOST }} > ~/.ssh/known_hosts
- name: connect and pull
run: |
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd ${{ secrets.WORK_DIR }} && docker compose pull && docker compose up -d"
- name: cleanup
run: rm -rf ~/.ssh