Skip to content

Commit 8298c9f

Browse files
committed
Merge branch 'master' of https://github.com/CodeShayk/eAuthor
2 parents 1c6a0d8 + 14d6e82 commit 8298c9f

File tree

2 files changed

+43
-54
lines changed

2 files changed

+43
-54
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,67 @@
1-
name: CI (Build, Test, Alpha Publish)
1+
name: Build, Test, and Deploy to Docker Hub
22

33
on:
4-
pull_request:
5-
branches: ["**"]
64
push:
7-
branches: ["**"]
8-
tags-ignore: ["v*"]
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
98

10-
permissions:
11-
contents: read
12-
packages: write
9+
env:
10+
REGISTRY: docker.io
11+
IMAGE_NAME: ${{ github.repository }}
1312

1413
jobs:
15-
build-test-pack:
14+
build-and-deploy:
1615
runs-on: ubuntu-latest
1716
env:
1817
working-directory: ${{ github.workspace }}
18+
1919
steps:
20-
- name: Checkout
20+
- name: Checkout code
2121
uses: actions/checkout@v4
2222
with:
23-
fetch-depth: 0 # GitVersion needs full history / tags
24-
25-
- name: Setup .NET
26-
uses: actions/setup-dotnet@v4
27-
with:
28-
dotnet-version: 9.0.x
29-
30-
- name: Install GitVersion
31-
uses: gittools/actions/gitversion/setup@v0.9.15
32-
with:
33-
versionSpec: 5.x
23+
fetch-depth: 0
24+
- name: Lint Code Base
25+
uses: github/super-linter@v4
26+
env:
27+
VALIDATE_ALL_CODEBASE: false
28+
FILTER_REGEX_INCLUDE: .*src/.*
29+
DEFAULT_BRANCH: master
30+
GITHUB_TOKEN: '${{ env.github-token }}'
3431

35-
- name: Determine Version
36-
id: gitversion
37-
uses: gittools/actions/gitversion/execute@v0.9.15
32+
- name: Set up .NET
33+
uses: actions/setup-dotnet@v3
3834
with:
39-
useConfigFile: true
35+
dotnet-version: '9.0.x'
4036

41-
- name: Display Version
42-
run: |
43-
echo "NuGetVersion: ${{ steps.gitversion.outputs.NuGetVersionV2 }}"
44-
echo "PreReleaseTag: ${{ steps.gitversion.outputs.PreReleaseTag }}"
45-
46-
- name: Restore
37+
- name: Restore dependencies
4738
run: dotnet restore
4839
working-directory: '${{ env.working-directory }}'
49-
40+
5041
- name: Build
51-
run: dotnet build --configuration Release --no-restore
42+
run: dotnet build --no-restore --configuration Release
5243
working-directory: '${{ env.working-directory }}'
5344

54-
- name: Test
55-
run: dotnet test --configuration Release --no-build --collect:"XPlat Code Coverage"
45+
- name: Run tests
46+
run: dotnet test --no-build --verbosity normal
5647
working-directory: '${{ env.working-directory }}'
48+
49+
- name: Set up Docker Buildx
50+
uses: docker/setup-buildx-action@v3
5751

58-
- name: Pack (Pre-release or Alpha)
59-
if: ${{ steps.gitversion.outputs.PreReleaseTag != '' && github.ref_type == 'branch' && github.ref != 'refs/heads/main' }}
60-
run: |
61-
dotnet pack src/eAuthor.API/eAuthor.API.csproj \
62-
-c Release -o artifacts \
63-
/p:PackageVersion=${{ steps.gitversion.outputs.NuGetVersionV2 }}
52+
- name: Login to Docker Hub
53+
uses: docker/login-action@v3
54+
with:
55+
username: ${{ secrets.DOCKERHUB_USERNAME }}
56+
password: ${{ secrets.DOCKERHUB_TOKEN }}
6457

65-
- name: Add GitHub Packages Source
66-
if: ${{ steps.gitversion.outputs.PreReleaseTag != '' && github.ref_type == 'branch' && github.ref != 'refs/heads/main' }}
67-
run: |
68-
dotnet nuget add source \
69-
--username $GITHUB_ACTOR \
70-
--password ${{ secrets.GITHUB_TOKEN }} \
71-
--store-password-in-clear-text \
72-
--name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
58+
- name: Build and push Docker image
59+
uses: docker/build-push-action@v5
60+
with:
61+
context: .
62+
push: true
63+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
7364

74-
- name: Publish Alpha to GitHub Packages
75-
if: ${{ steps.gitversion.outputs.PreReleaseTag != '' && github.ref_type == 'branch' && github.ref != 'refs/heads/main' }}
76-
run: dotnet nuget push "artifacts/*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate
65+
- name: Logout from Docker Hub
66+
if: always()
67+
run: docker logout

nuget.config

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
4-
<!-- GitHub Packages (used for consuming internal prereleases if needed) -->
5-
<add key="github" value="https://nuget.pkg.github.com/YourOrg/index.json" />
64
<!-- Official NuGet -->
75
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
86
</packageSources>

0 commit comments

Comments
 (0)