Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ecdea4d07c | |||
| 628f84c14b | |||
| a52d2c9fe9 | |||
| 32bce2cdd2 | |||
| 490ed3815f |
@@ -19,6 +19,11 @@ jobs:
|
||||
image: mcr-mirror.liara.ir/dotnet/sdk:10.0.202
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
shell: bash
|
||||
run: |
|
||||
git clone --depth 1 https://git.sabp.ir/sufi-chain/dev-ops-test.git .
|
||||
|
||||
- name: Build and push image
|
||||
shell: bash
|
||||
env:
|
||||
@@ -36,11 +41,12 @@ jobs:
|
||||
tag="${RELEASE_TAG:-$REF_NAME}"
|
||||
tag="${tag#v}"
|
||||
dotnet publish DevOpsTest.csproj \
|
||||
-v:n \
|
||||
--configuration Release \
|
||||
--os linux \
|
||||
--arch x64 \
|
||||
/t:PublishContainer \
|
||||
-p:ContainerRegistry="$REGISTRY" \
|
||||
-p:ContainerRepository="$IMAGE_NAME" \
|
||||
-p:ContainerBaseImage=mcr-mirror.liara.ir/dotnet/aspnet:10.0.202 \
|
||||
-p:ContainerBaseImage=mcr-mirror.liara.ir/dotnet/aspnet:10.0 \
|
||||
-p:ContainerImageTags="$tag;latest"
|
||||
|
||||
@@ -8,7 +8,7 @@ on:
|
||||
env:
|
||||
DOTNET_NOLOGO: true
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
||||
NUGET_SOURCE_URL: https://nuget.sabp.ir/v3/index.json
|
||||
NUGET_SOURCE_URL: ${{ secrets.NUGET_API_URL }}
|
||||
PACKAGE_OUTPUT: ./artifacts/nuget
|
||||
PACKAGE_PROJECTS: DevOpsPackageTest/DevOpsPackageTest.csproj
|
||||
RELEASE_TAG: ${{ gitea.event.release.tag_name }}
|
||||
@@ -22,12 +22,41 @@ jobs:
|
||||
image: mcr-mirror.liara.ir/dotnet/sdk:10.0.202
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
shell: bash
|
||||
run: |
|
||||
git clone --depth 1 https://git.sabp.ir/sufi-chain/dev-ops-test.git .
|
||||
|
||||
- name: Create NuGet.Config for HTTP BaGet
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
if [ -z "${NUGET_SOURCE_URL:-}" ]; then
|
||||
echo "NUGET_SOURCE_URL secret/env is required."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat > NuGet.Config <<EOF
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="baget" value="${NUGET_SOURCE_URL}" allowInsecureConnections="true" />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
EOF
|
||||
|
||||
echo "NuGet.Config created:"
|
||||
cat NuGet.Config
|
||||
|
||||
- name: Restore selected projects
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
for project in $PACKAGE_PROJECTS; do
|
||||
dotnet restore "$project"
|
||||
dotnet restore "$project" --configfile NuGet.Config
|
||||
done
|
||||
|
||||
- name: Build selected projects
|
||||
@@ -62,6 +91,7 @@ jobs:
|
||||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
if [ -z "${NUGET_API_KEY:-}" ]; then
|
||||
echo "NUGET_API_KEY secret is required."
|
||||
exit 1
|
||||
@@ -69,14 +99,17 @@ jobs:
|
||||
|
||||
shopt -s nullglob
|
||||
packages=("$PACKAGE_OUTPUT"/*.nupkg)
|
||||
|
||||
if [ ${#packages[@]} -eq 0 ]; then
|
||||
echo "No NuGet packages were produced."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for package in "${packages[@]}"; do
|
||||
echo "Pushing $package ..."
|
||||
dotnet nuget push "$package" \
|
||||
--source "$NUGET_SOURCE_URL" \
|
||||
--source baget \
|
||||
--api-key "$NUGET_API_KEY" \
|
||||
--skip-duplicate
|
||||
--skip-duplicate \
|
||||
--configfile NuGet.Config
|
||||
done
|
||||
|
||||
Binary file not shown.
+2
-2
@@ -1,6 +1,6 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM mcr-mirror.liara.ir/dotnet/sdk:10.0.202 AS build
|
||||
FROM mcr-mirror.liara.ir/dotnet/sdk:10.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
COPY DevOpsTest.csproj ./
|
||||
@@ -13,7 +13,7 @@ RUN dotnet publish DevOpsTest.csproj \
|
||||
--output /app/publish \
|
||||
/p:UseAppHost=false
|
||||
|
||||
FROM mcr-mirror.liara.ir/dotnet/aspnet:10.0.202 AS final
|
||||
FROM mcr-mirror.liara.ir/dotnet/aspnet:10.0 AS final
|
||||
WORKDIR /app
|
||||
|
||||
ENV ASPNETCORE_URLS=http://+:8080 \
|
||||
|
||||
Reference in New Issue
Block a user