66 lines
2.0 KiB
YAML
66 lines
2.0 KiB
YAML
name: release-tag
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
env:
|
|
DOCKER_LATEST: latest
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Get Meta
|
|
id: meta
|
|
run: |
|
|
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
|
|
echo REPO_VERSION=${GITHUB_REF_NAME#v} >> $GITHUB_OUTPUT
|
|
|
|
# - name: Debug metadata outputs
|
|
# run: echo "${{ toJson(steps.meta.outputs) }}"
|
|
|
|
- name: Create .env file
|
|
run: |
|
|
echo "YCLIENTS_ABONEMENTS_API_URL=${{ vars.YCLIENTS_ABONEMENTS_API_URL }}" > .env
|
|
echo "YCLIENTS_ABONEMENTS_TOKEN=${{ vars.YCLIENTS_ABONEMENTS_TOKEN }}" >>.env
|
|
echo "YCLIENTS_API_URL=${{ vars.YCLIENTS_API_URL }}" >>.env
|
|
echo "YCLIENTS_TOKEN=${{ vars.YCLIENTS_TOKEN }}" >>.env
|
|
|
|
- name: Log in to Docker registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ vars.DOCKER_REGISTRY }}
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
target: basic
|
|
push: true
|
|
tags: |
|
|
${{ vars.DOCKER_REGISTRY }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
|
|
${{ vars.DOCKER_REGISTRY }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}
|
|
|
|
- name: Trigger Dokploy Deployment
|
|
run: |
|
|
curl -X 'POST' \
|
|
'https://${{ vars.DOKPLOY_DOMAIN }}/api/trpc/application.deploy' \
|
|
-H 'accept: application/json' \
|
|
-H 'x-api-key:${{ secrets.DOKPLOY_API_KEY }}' \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{
|
|
"json":{
|
|
"applicationId": "${{ vars.DOKPLOY_APPLICATION_ID }}"
|
|
}
|
|
}'
|