diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 0000000..15f9d8c --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,41 @@ +name: "Audit pipeline" + +on: + push: + branches: [ "main", "next" ] + paths-ignore: + - '.devcontainer/*' + - '.github/*' + - '!.github/workflows/audit.yml' + - '.vscode/*' + - '**.md' + - 'Properties/launchSettings.json' + - 'appsettings*.json' + - 'LICENSE' + pull_request: + branches: [ "main", "next" ] + paths-ignore: + - '.devcontainer/*' + - '.github/*' + - '!.github/workflows/ci.yml' + - '.vscode/*' + - '**.md' + - 'Properties/launchSettings.json' + - 'appsettings*.json' + - 'LICENSE' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + permissions: + packages: write + + steps: + - uses: actions/checkout@v5 + + - uses: docker/build-push-action@v6 + with: + context: . + tags: "backbone:ci" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 983eef0..ac25faf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,33 +1,9 @@ name: "CI pipeline" on: - push: - branches: [ "main" ] - paths-ignore: - - '.devcontainer/*' - - '.github/*' - - '!.github/workflows/ci.yml' - - '.vscode/*' - - '**.md' - - 'Properties/launchSettings.json' - - 'LICENSE' - pull_request: - branches: [ "main", "next" ] - paths-ignore: - - '.devcontainer/*' - - '.github/*' - - '!.github/workflows/ci.yml' - - '.vscode/*' - - '**.md' - - 'Properties/launchSettings.json' - - 'LICENSE' + release: + types: [ published ] workflow_dispatch: - inputs: - push: - type: boolean - required: false - default: false - description: "Push to Docker Hub" jobs: build: @@ -37,7 +13,12 @@ jobs: packages: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 + + - name: Update assembly version + if: startsWith(github.ref, 'refs/tags/') + run: | + sed -i 's|AssemblyVersion("1.0.0.0")|AssemblyVersion("${{ github.ref_name }}")|' Program.cs - uses: docker/metadata-action@v5 id: meta @@ -47,17 +28,15 @@ jobs: ghcr.io/${{ github.repository }} tags: | latest - ${{ github.sha }} + ${{ github.ref_name }} - name: "Login to Docker Hub" - if: github.event_name != 'pull_request' || github.event.inputs.push == 'true' uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: "Login to GitHub Container Registry" - if: github.event_name != 'pull_request' || github.event.inputs.push == 'true' uses: docker/login-action@v3 with: registry: ghcr.io @@ -67,5 +46,5 @@ jobs: - uses: docker/build-push-action@v6 with: context: . - push: ${{ github.event_name != 'pull_request' || github.event.inputs.push == 'true' }} + push: true tags: ${{ steps.meta.outputs.tags }} diff --git a/Dockerfile b/Dockerfile index 25d3c9a..27234cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,4 +17,5 @@ COPY --from=build /out/Backbone . COPY --from=build /out/appsettings*.json . EXPOSE 80 -ENTRYPOINT [ "./Backbone", "--urls", "http://*:80" ] +ENTRYPOINT [ "./Backbone" ] +CMD [ "--urls", "http://*:80" ] diff --git a/Program.cs b/Program.cs index 94a02d7..ade028e 100644 --- a/Program.cs +++ b/Program.cs @@ -1,7 +1,12 @@ +using System.Reflection; using System.Text.Json.Serialization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyCompany("Eugene Fox")] +[assembly: AssemblyCopyright("© Eugene Fox 2025")] + WebApplicationBuilder builder = WebApplication.CreateSlimBuilder(args); builder.Services.AddSignalR();