Skip to content
This repository has been archived by the owner on Dec 23, 2023. It is now read-only.

Commit

Permalink
Update deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
JUtupe committed Oct 22, 2023
1 parent 668d5b1 commit 7ca8c98
Showing 1 changed file with 68 additions and 68 deletions.
136 changes: 68 additions & 68 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,83 +1,83 @@
name: Deploy
# name: Deploy

concurrency:
group: prod
cancel-in-progress: true
# concurrency:
# group: prod
# cancel-in-progress: true

on:
push:
tags:
- 'v*'
# on:
# push:
# tags:
# - 'v*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
# env:
# REGISTRY: ghcr.io
# IMAGE_NAME: ${{ github.repository }}

jobs:
build:
name: Build
runs-on: ubuntu-latest
# jobs:
# build:
# name: Build
# runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
# steps:
# - uses: actions/checkout@v2

- name: Use Node.js 16.10.0
uses: actions/setup-node@v2
with:
node-version: '16.10.0'
cache: 'npm'
# - name: Use Node.js 16.10.0
# uses: actions/setup-node@v2
# with:
# node-version: '16.10.0'
# cache: 'npm'

- run: npm ci
# - run: npm ci

- run: npm run build
# - run: npm run build

docker:
name: Build Docker Image
runs-on: ubuntu-latest
needs: [ build ]
# docker:
# name: Build Docker Image
# runs-on: ubuntu-latest
# needs: [ build ]

steps:
- uses: actions/checkout@v2
# steps:
# - uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# - name: Log in to the Container registry
# uses: docker/login-action@v2
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v4
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
build-args: |
API_URL=${{ secrets.API_URL }}
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# - name: Build and push Docker image
# uses: docker/build-push-action@v3
# with:
# build-args: |
# API_URL=${{ secrets.API_URL }}
# context: .
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}

deploy:
name: Deploy
runs-on: ubuntu-latest
environment: Production
needs: [ docker ]
# deploy:
# name: Deploy
# runs-on: ubuntu-latest
# environment: Production
# needs: [ docker ]

steps:
- name: Deploy package to production
uses: appleboy/ssh-action@v0.1.5
with:
host: ${{ secrets.SSH_IP }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
script: |
cd web
docker-compose down
docker image rm ghcr.io/newbies-workplace/jeteo-web
docker pull ghcr.io/newbies-workplace/jeteo-web:latest
docker-compose up -d
# steps:
# - name: Deploy package to production
# uses: appleboy/ssh-action@v0.1.5
# with:
# host: ${{ secrets.SSH_IP }}
# username: ${{ secrets.SSH_USER }}
# password: ${{ secrets.SSH_PASSWORD }}
# script: |
# cd web
# docker-compose down
# docker image rm ghcr.io/newbies-workplace/jeteo-web
# docker pull ghcr.io/newbies-workplace/jeteo-web:latest
# docker-compose up -d

0 comments on commit 7ca8c98

Please sign in to comment.