chore: test out deploy script
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/pwsh
|
||||||
|
|
||||||
|
Write-Host "Deploying to production..."
|
||||||
@@ -15,27 +15,53 @@ on:
|
|||||||
- '**/*/README.md'
|
- '**/*/README.md'
|
||||||
- '**/*/Dockerfile'
|
- '**/*/Dockerfile'
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
# build:
|
||||||
name: Build and push Docker image
|
# 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
|
||||||
|
deploy:
|
||||||
|
name: Deploy to server
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
# needs: build
|
||||||
version: ${{ steps.version.outputs.version }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Login to Docker Hub
|
- name: Copy files to server
|
||||||
uses: docker/login-action@v3
|
uses: appleboy/scp-action@v0.1.7
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
host: ${{ secrets.SSH_HOST }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
username: ${{ secrets.SSH_USERNAME }}
|
||||||
- name: Create version tag
|
key: ${{ secrets.SSH_KEY }}
|
||||||
id: version
|
source: ".github/scripts/deploy.ps1"
|
||||||
run: echo "version=$(date +%Y.%m.%d.%H%M%S)" >> $GITHUB_OUTPUT
|
target: blog.stevanfreeborn.com
|
||||||
- name: Build and push server image
|
- name: Run deploy script
|
||||||
working-directory: src/Blog
|
uses: appleboy/ssh-action@master
|
||||||
run: |
|
with:
|
||||||
TAG=${{ secrets.DOCKERHUB_USERNAME }}/blog.stevanfreeborn.com:${{ steps.version.outputs.version }}
|
host: ${{ secrets.SSH_HOST }}
|
||||||
docker build -t $TAG .
|
username: ${{ secrets.SSH_USERNAME }}
|
||||||
docker push $TAG
|
key: ${{ secrets.SSH_KEY }}
|
||||||
|
script: |
|
||||||
|
cd blog.stevanfreeborn.com
|
||||||
|
./.github/scripts/deploy.ps1
|
||||||
Reference in New Issue
Block a user