54 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| name: Caddy Manager CI build
 | |
| run-name: ${{ gitea.actor }} is running CI pipeline
 | |
| on:
 | |
|   push:
 | |
|     branches:
 | |
|       - main
 | |
| 
 | |
| jobs:
 | |
|   docker:
 | |
|     env:
 | |
|       RUNNER_TOOL_CACHE: /toolcache
 | |
|       NUGET_PACKAGES: ${{ gitea.workspace }}/.nuget/packages
 | |
|     runs-on: ubuntu-latest
 | |
|     steps:
 | |
|       -
 | |
|         name: Login to Gitea
 | |
|         uses: docker/login-action@v3
 | |
|         with:
 | |
|           registry: http://${{ vars.DOCKER_GITEA_DOMAIN }}
 | |
|           username: ${{ vars.DOCKER_GITEA_USERNAME }}
 | |
|           password: ${{ secrets.DOCKER_GITEA_PAT }}
 | |
|           config-inline: |
 | |
|             [registry."${{ vars.DOCKER_GITEA_DOMAIN }}"]
 | |
|               http = true
 | |
|               insecure = true            
 | |
|       - uses: actions/checkout@v4
 | |
|       - uses: actions/setup-dotnet@v3
 | |
|         with:
 | |
|           dotnet-version: '9' # SDK Version to use.
 | |
|           dotnet-quality: 'ga'
 | |
|           cache: true
 | |
|           cache-dependency-path: '**/packages.lock.json'
 | |
|       - name: Restore dependencies 
 | |
|         run: dotnet restore --locked-mode
 | |
|       - name: Application metadata
 | |
|         id: metadata
 | |
|         run: |
 | |
|           echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
 | |
|           echo "APP_VERSION=$(grep 'public static readonly string Version' CaddyManager/Configurations/Application/ApplicationInfo.cs | sed -E 's/.*"([^"]+)".*/\1/')" >> $GITHUB_OUTPUT
 | |
|       - name: Patch application info
 | |
|         run: |
 | |
|           sed -i "s/public static readonly string CommitHash = \"\[DEVELOPMENT\]\";/public static readonly string CommitHash = \"${{ steps.metadata.outputs.COMMIT_HASH }}\";/" CaddyManager/Configurations/Application/ApplicationInfo.cs
 | |
|       - name: Publish container
 | |
|         run: |
 | |
|           dotnet publish \
 | |
|           --configuration Release --os linux --arch x64 \
 | |
|           /t:PublishContainer -p ContainerRegistry=${{ vars.DOCKER_GITEA_DOMAIN }} \
 | |
|           -p ContainerRepository=ebolo/caddy-manager -p:ContainerImageTags='"${{ steps.metadata.outputs.APP_VERSION }};latest"'
 | |
|       - name: Deploy to Komodo
 | |
|         uses: fjogeleit/http-request-action@v1
 | |
|         with:
 | |
|           url: '${{ vars.WINDMILL_DOMAIN }}/komodo/pull-stack/${{ secrets.KOMODO_STACK_ID }}'
 | |
|           method: 'PUT'
 | |
|           customHeaders: '{"Auth-Key": "${{ secrets.WINDMILL_KEY }}"}' |