Merge pull request #122 from Tobi2K/depfu-batch_all-npm-2023-12-04 #225
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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }} | |
FIREBASE_PRIVATE_KEY: ${{ secrets.FIREBASE_PRIVATE_KEY }} | |
FIREBASE_CLIENT_EMAIL: ${{ secrets.FIREBASE_CLIENT_EMAIL }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
branch_name: ${{ steps.branch-name.outputs.current_branch }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Docker Login | |
uses: docker/login-action@v1.10.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Branch Name | |
uses: tj-actions/branch-names@v5.1 | |
id: branch-name | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: ghcr.io/tobi2k/top-tips | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: SSH into server and pull image | |
uses: fifsky/ssh-action@master | |
with: | |
command: | | |
docker pull ghcr.io/tobi2k/top-tips | |
docker stop top-tips-server | |
docker rm top-tips-server | |
rm ./.env && touch ./.env | |
echo 'API_KEY=${{ secrets.API_KEY }}' >> ./.env | |
echo 'APP_VERSION=${{ secrets.APP_VERSION }}' >> ./.env | |
echo 'CRON=${{ secrets.CRON }}' >> ./.env | |
echo 'JWT_SECRET=${{ secrets.JWT_SECRET }}' >> ./.env | |
echo 'FIREBASE_PROJECT_ID=${{ secrets.FIREBASE_PROJECT_ID }}' >> ./.env | |
echo 'FIREBASE_PRIVATE_KEY=${{ secrets.FIREBASE_PRIVATE_KEY }}' >> ./.env | |
echo 'FIREBASE_CLIENT_EMAIL=${{ secrets.FIREBASE_CLIENT_EMAIL }}' >> ./.env | |
docker run -d --restart unless-stopped --network host --name=top-tips-server --env-file ./.env ghcr.io/tobi2k/top-tips | |
host: ${{ secrets.HOST }} | |
user: root | |
key: ${{ secrets.PRIVATE_KEY}} |