new pipeline
This commit is contained in:
51
.gitea/workflows/deploy.yaml
Normal file
51
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
name: Homepage Deploy (Production)
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY_HOST: git.ivanch.me
|
||||||
|
REGISTRY_USERNAME: ivanch
|
||||||
|
IMAGE_NAME: ${{ env.REGISTRY_HOST }}/ivanch/mainpage
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build Homepage Image
|
||||||
|
runs-on: ubuntu-amd64
|
||||||
|
outputs:
|
||||||
|
short_sha: ${{ steps.vars.outputs.short_sha }}
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Export short commit SHA
|
||||||
|
id: vars
|
||||||
|
shell: bash
|
||||||
|
run: echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Build and Push Multi-Arch Image
|
||||||
|
uses: https://git.ivanch.me/ivanch/pipeline-actions/build-and-push@main
|
||||||
|
with:
|
||||||
|
image: ${{ env.IMAGE_NAME }}
|
||||||
|
image_tag: latest
|
||||||
|
registry_password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
ssh_key: ${{ secrets.SSH_KEY_DOCKERBUILD }}
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
name: Deploy Homepage
|
||||||
|
runs-on: ubuntu-amd64
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Recreate Container
|
||||||
|
uses: https://git.ivanch.me/ivanch/pipeline-actions/ssh-deploy@main
|
||||||
|
with:
|
||||||
|
ssh_host: ${{ secrets.HOST }}
|
||||||
|
ssh_username: ${{ secrets.USERNAME }}
|
||||||
|
ssh_key: ${{ secrets.KEY }}
|
||||||
|
ssh_port: ${{ secrets.PORT }}
|
||||||
|
remote_dir: ${{ secrets.DIR }}
|
||||||
|
image: ${{ env.IMAGE_NAME }}
|
||||||
|
image_tag: latest
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Homepage Build and Deploy
|
name: Homepage Build and Deploy (Test)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -15,14 +15,22 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build Homepage Image
|
name: Build Homepage Image
|
||||||
runs-on: ubuntu-amd64
|
runs-on: ubuntu-amd64
|
||||||
|
outputs:
|
||||||
|
short_sha: ${{ steps.vars.outputs.short_sha }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Export short commit SHA
|
||||||
|
id: vars
|
||||||
|
shell: bash
|
||||||
|
run: echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Build and Push Multi-Arch Image
|
- name: Build and Push Multi-Arch Image
|
||||||
uses: https://git.ivanch.me/ivanch/pipeline-actions/build-and-push@main
|
uses: https://git.ivanch.me/ivanch/pipeline-actions/build-and-push@main
|
||||||
with:
|
with:
|
||||||
image: ${{ env.IMAGE_NAME }}
|
image: ${{ env.IMAGE_NAME }}
|
||||||
|
image_tag: ${{ steps.vars.outputs.short_sha }}
|
||||||
registry_password: ${{ secrets.REGISTRY_PASSWORD }}
|
registry_password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
ssh_key: ${{ secrets.SSH_KEY_DOCKERBUILD }}
|
ssh_key: ${{ secrets.SSH_KEY_DOCKERBUILD }}
|
||||||
|
|
||||||
@@ -41,4 +49,6 @@ jobs:
|
|||||||
ssh_username: ${{ secrets.USERNAME }}
|
ssh_username: ${{ secrets.USERNAME }}
|
||||||
ssh_key: ${{ secrets.KEY }}
|
ssh_key: ${{ secrets.KEY }}
|
||||||
ssh_port: ${{ secrets.PORT }}
|
ssh_port: ${{ secrets.PORT }}
|
||||||
remote_dir: ${{ secrets.DIR }}
|
remote_dir: ${{ secrets.TEST_DIR }}
|
||||||
|
image: ${{ env.IMAGE_NAME }}
|
||||||
|
image_tag: ${{ needs.build.outputs.short_sha }}
|
||||||
|
|||||||
Reference in New Issue
Block a user