chore: add deploy workflow
This commit is contained in:
@@ -0,0 +1,41 @@
|
|||||||
|
name: Deploy
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- '.github/**'
|
||||||
|
- '.vscode/**'
|
||||||
|
- '.gitignore'
|
||||||
|
- '.editorconfig'
|
||||||
|
- 'LICENSE.md'
|
||||||
|
- 'docker-compose.dev.yml'
|
||||||
|
- 'docker-compose.prod.yml'
|
||||||
|
- '**/*/README.md'
|
||||||
|
- '**/*/Dockerfile'
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build and push Docker image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Create version tag
|
||||||
|
id: version
|
||||||
|
run: echo "version=$(date +%Y%m%d%H%M%S)" >> $GITHUB_OUTPUT
|
||||||
|
- name: Build and push server image
|
||||||
|
working-directory: src/Blog
|
||||||
|
run: |
|
||||||
|
TAG=${{ secrets.DOCKERHUB_USERNAME }}/blog.stevanfreeborn.com:${{ steps.version.outputs.version }}
|
||||||
|
docker build -t $TAG .
|
||||||
|
docker push $TAG
|
||||||
@@ -10,6 +10,7 @@ on:
|
|||||||
- '.editorconfig'
|
- '.editorconfig'
|
||||||
- 'LICENSE.md'
|
- 'LICENSE.md'
|
||||||
- 'docker-compose.dev.yml'
|
- 'docker-compose.dev.yml'
|
||||||
|
- 'docker-compose.prod.yml'
|
||||||
- '**/*/README.md'
|
- '**/*/README.md'
|
||||||
- '**/*/Dockerfile'
|
- '**/*/Dockerfile'
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
Reference in New Issue
Block a user