normal deployment
This commit is contained in:
64
.gitea/workflows/deploy.yml
Normal file
64
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,64 @@
|
||||
name: Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Determine image tag
|
||||
id: image_tag
|
||||
run: |
|
||||
if [[ ${{ github.ref }} == refs/tags/* ]]; then
|
||||
IMAGE_TAG=${{ github.ref_name }}
|
||||
elif [[ ${{ github.ref }} == refs/heads/develop ]]; then
|
||||
IMAGE_TAG="develop"
|
||||
fi
|
||||
echo "tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
|
||||
echo "Image tag will be: $IMAGE_TAG"
|
||||
|
||||
- name: Build and push image
|
||||
id: docker_build
|
||||
uses: ./.gitea/actions/build
|
||||
with:
|
||||
tag: ${{ steps.image_tag.outputs.tag }}
|
||||
REGISTRY_ACCESS_TOKEN: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
||||
REGISTRY_USER: ${{ gitea.actor }}
|
||||
|
||||
- name: Create environment file
|
||||
run: |
|
||||
cat > .env << EOF
|
||||
TOLGEE_API_URL=${{ vars.TOLGEE_API_URL }}
|
||||
TOLGEE_API_KEY=${{ secrets.TOLGEE_API_KEY }}
|
||||
TRANSLATION_CACHE_TTL=${{ vars.TRANSLATION_CACHE_TTL }}
|
||||
EOF
|
||||
|
||||
- name: Determine URL
|
||||
id: url
|
||||
run: |
|
||||
if [[ ${{ github.ref_type }} == "tag" ]]; then
|
||||
URL="phoenix.klemp.local"
|
||||
elif [[ ${{ github.ref_name }} == "develop" ]]; then
|
||||
URL="develop.phoenix.klemp.local"
|
||||
fi
|
||||
echo "url=$URL" >> $GITHUB_OUTPUT
|
||||
echo "URL will be: $URL"
|
||||
|
||||
- name: Deploy application
|
||||
uses: ./.gitea/actions/deploy
|
||||
with:
|
||||
project_name: ${{ steps.branch_name.outputs.branch_name }}
|
||||
url: '${{ steps.url.outputs.url }}'
|
||||
image_url: ${{ steps.docker_build.outputs.image_url }}
|
||||
deployment_key: ${{ secrets.SSH_DEPLOYMENT_KEY }}
|
||||
ssh_host: ${{ vars.ssh_host }}
|
||||
ssh_port: ${{ vars.ssh_port }}
|
||||
ssh_user: ${{ vars.ssh_user }}
|
||||
Reference in New Issue
Block a user