https://github.com/sitkoru/docker-deploy-action
Action to deploy docker container
https://github.com/sitkoru/docker-deploy-action
Last synced: 8 months ago
JSON representation
Action to deploy docker container
- Host: GitHub
- URL: https://github.com/sitkoru/docker-deploy-action
- Owner: sitkoru
- License: mit
- Created: 2022-01-11T05:49:11.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-06T04:59:35.000Z (about 2 years ago)
- Last Synced: 2025-09-05T10:02:14.948Z (10 months ago)
- Language: JavaScript
- Size: 15.6 KB
- Stars: 0
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# docker-deploy-action
Action to deploy docker container
```yml
name: Release
on:
release:
types:
- released
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.prep.outputs.version }}
steps:
- name: Prepare
id: prep
shell: bash
run: |
DOCKER_IMAGE=${{ secrets.DOCKER_REGISTRY_URL }}/${{ secrets.DOCKER_IMAGE_NAME }}
VERSION=${GITHUB_REF#refs/tags/}
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
MINOR=${VERSION%.*}
MAJOR=${MINOR%.*}
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:latest"
fi
echo ::set-output name=tags::${TAGS}
echo ::set-output name=version::${VERSION}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
# build docker image
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Deploy service
uses: sitkoru/docker-deploy-action@v1
with:
name: ${{ secrets.SERVICE_NAME }}
version: ${{ needs.build.outputs.version }}
host: ${{ secrets.DEPLOY_HOST }}
user: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
dir: ${{ secrets.HOST_WORKING_DIR }}
script: ${{ secrets.HOST_COMPOSE_SCRIPT }}
# uncomment if service needs Vault
# vault_policy: ${{ secrets.VAULT_POLICY }}
# vault_container: ${{ secrets.VAULT_CONTAINER }}
# vault_username: ${{ secrets.VAULT_USERNAME }}
# vault_password: ${{ secrets.VAULT_PASSWORD }}
# vault_period: ${{ secrets.VAULT_PERIOD }}
# uncomment if service needs login to docker registry
# docker_registry_login: ${{ secrets.DOCKER_REGISTRY_LOGIN }}
# docker_registry_password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
# docker_registry_url: ${{ secrets.DOCKER_REGISTRY_URL }}
```