Add first workflows

This commit is contained in:
2023-11-19 11:52:24 +01:00
parent ae53aa4498
commit 373af6f3fa
4 changed files with 90 additions and 2 deletions
+44
View File
@@ -0,0 +1,44 @@
name: build
run-name: ${{ gitea.actor }} is building docker image ${{ gitea.repository }} on ${{ gitea.ref }}
on:
workflow_call:
secrets:
PERSONAL_ACCESS_TOKEN:
required: true
env:
IMAGE_TAG: ${{ gitea.ref_name == 'master' && 'latest' || gitea.ref_name }}
IMAGE_NAME: ${{ gitea.repository }}
jobs:
build:
runs-on: docker
steps:
- name: get registry from current GITHUB_SERVER_URL
run: echo "REGISTRY=${GITHUB_SERVER_URL//https:\/\//}" >> $GITHUB_ENV
- name: build image reference
run: echo "IMAGE_URL=${{ env.REGISTRY }}/${GITHUB_REPOSITORY,,}:${{ env.IMAGE_TAG }}" >> $GITHUB_ENV
- name: Check out repository code
uses: https://gitea.com/actions/checkout@v3
- name: login to registry
run: |
docker login -u ${{ gitea.actor }} -p ${{ secrets.PERSONAL_ACCESS_TOKEN }} ${{ env.REGISTRY }}
- name: build image
run: |
docker build --progress plain \
--cache-from ${{ env.IMAGE_URL }} \
--pull \
--no-cache \
-t ${{ env.IMAGE_URL }} .
- name: push image
run: |
docker push ${{ env.IMAGE_URL }}
- name: logout from registry
run: |
docker logout ${{ env.REGISTRY }}
+36
View File
@@ -0,0 +1,36 @@
name: deploy
run-name: ${{ gitea.actor }} is deploying ${{ gitea.repository }} on ${{ gitea.ref }}
on:
workflow_call:
inputs:
SSH_HOST:
type: string
required: true
SSH_USER:
type: string
required: true
SSH_PORT:
type: number
required: false
default: 22
DEPLOY_PATH:
type: string
required: true
secrets:
SSH_PASSWORD:
required: false
jobs:
build:
uses: ./.gitea/workflows/build.yml
deploy:
runs-on: docker
needs: build
steps:
- name: Check out repository code
uses: https://gitea.com/actions/checkout@v3
- name: deploy to remote host
run: |
SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p ${{ inputs.SSH_PORT }} ${{ inputs.SSH_USER }}@${{ inputs.SSH_HOST }}"
+2
View File
@@ -0,0 +1,2 @@
.idea
.vscode
+8 -2
View File
@@ -1,3 +1,9 @@
# workflows
# Workflows
Containing default workflows which can be used in other repositoreis.
Containing default workflows which can be used in other repositories.
## Docker build and push
## Deploy
## Run tests