Template
28 lines
872 B
YAML
28 lines
872 B
YAML
name: Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
validate-image:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@v4
|
|
- name: Validate deployment files
|
|
run: test -f deploy/Dockerfile && test -f deploy/docker-compose.yml
|
|
- name: Build image when registry credentials exist
|
|
if: ${{ secrets.REGISTRY_URL != '' && secrets.REGISTRY_TOKEN != '' }}
|
|
env:
|
|
REGISTRY_URL: ${{ secrets.REGISTRY_URL }}
|
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
run: |
|
|
echo "$REGISTRY_TOKEN" | docker login "$REGISTRY_URL" --username "${{ secrets.REGISTRY_USER }}" --password-stdin
|
|
docker build -f deploy/Dockerfile -t "$REGISTRY_URL/agent:${{ gitea.sha }}" .
|
|
docker push "$REGISTRY_URL/agent:${{ gitea.sha }}"
|