Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

chore(deps): update appleboy/ssh-action action to v1.0.2 (#38) #45

chore(deps): update appleboy/ssh-action action to v1.0.2 (#38)

chore(deps): update appleboy/ssh-action action to v1.0.2 (#38) #45

Workflow file for this run

name: Build Images
on:
push:
branches:
- main
tags:
- 'v*'
env:
IMAGE_TAG_BASE: docker.io/koorinc/version-service
jobs:
build:
name: Build and push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
${{ env.IMAGE_TAG_BASE }}
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=raw,value=latest,enable={{is_default_branch}}
type=sha,format=long,prefix={{branch}}-,enable={{is_default_branch}}
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
generate_release_notes: true
- name: Deploy
uses: appleboy/ssh-action@v1.0.2
if: github.ref == 'refs/heads/main'
env:
SHA: ${{ github.sha }}
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.SSH_KEY }}
envs: SHA
script: |
docker rm vs --force
docker run --label version-service --name vs -d -p 443:8082 --volume=/root/certs:/certs koorinc/version-service:main-$SHA