7 Commits

Author SHA1 Message Date
pooria.sh ecdea4d07c ci7
Release Docker Image / build-and-push (release) Failing after 9s
Release NuGet Packages / pack-and-push (release) Failing after 6m58s
2026-05-20 15:28:37 +03:30
pooria.sh 628f84c14b Update release-nuget.yml
Release Docker Image / build-and-push (release) Failing after 7s
Release NuGet Packages / pack-and-push (release) Failing after 1m52s
2026-05-20 15:21:53 +03:30
pooria.sh a52d2c9fe9 ci6
Release Docker Image / build-and-push (release) Failing after 29s
Release NuGet Packages / pack-and-push (release) Has been cancelled
2026-05-20 15:13:14 +03:30
pooria.sh 32bce2cdd2 ci5
Release NuGet Packages / pack-and-push (release) Successful in 2m54s
Release Docker Image / build-and-push (release) Failing after 1m18s
2026-05-20 14:41:47 +03:30
pooria.sh 490ed3815f ci4
Release NuGet Packages / pack-and-push (release) Failing after 3s
Release Docker Image / build-and-push (release) Has been cancelled
2026-05-20 14:35:27 +03:30
pooria.sh 97d20d3c8a ci2
Release Docker Image / build-and-push (release) Has been cancelled
Release NuGet Packages / pack-and-push (release) Has been cancelled
2026-05-20 14:27:46 +03:30
pooria.sh babcb85254 update ci
Release Docker Image / build-and-push (release) Failing after 1m10s
Release NuGet Packages / pack-and-push (release) Failing after 3s
2026-05-20 13:53:08 +03:30
4 changed files with 55 additions and 27 deletions
+16 -19
View File
@@ -10,29 +10,27 @@ env:
IMAGE_NAME: sabp-apps/devops-test
RELEASE_TAG: ${{ gitea.event.release.tag_name }}
REF_NAME: ${{ gitea.ref_name }}
REPOSITORY: ${{ gitea.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
container:
image: mcr-mirror.liara.ir/dotnet/sdk:10.0
image: mcr-mirror.liara.ir/dotnet/sdk:10.0.202
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Docker CLI
shell: bash
run: |
set -euo pipefail
apt-get update
apt-get install -y docker.io
git clone --depth 1 https://git.sabp.ir/sufi-chain/dev-ops-test.git .
- name: Login to Harbor
- name: Build and push image
shell: bash
env:
HARBOR_USERNAME: ${{ secrets.HARBOR_USERNAME }}
HARBOR_PASSWORD: ${{ secrets.HARBOR_PASSWORD }}
DOTNET_CONTAINER_REGISTRY_UNAME: ${{ secrets.HARBOR_USERNAME }}
DOTNET_CONTAINER_REGISTRY_PWORD: ${{ secrets.HARBOR_PASSWORD }}
run: |
set -euo pipefail
if [ -z "${HARBOR_USERNAME:-}" ] || [ -z "${HARBOR_PASSWORD:-}" ]; then
@@ -40,16 +38,15 @@ jobs:
exit 1
fi
echo "$HARBOR_PASSWORD" | docker login "$REGISTRY" --username "$HARBOR_USERNAME" --password-stdin
- name: Build and push image
shell: bash
run: |
set -euo pipefail
tag="${RELEASE_TAG:-$REF_NAME}"
tag="${tag#v}"
image="$REGISTRY/$IMAGE_NAME"
docker build --pull -t "$image:$tag" -t "$image:latest" .
docker push "$image:$tag"
docker push "$image:latest"
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 \
-p:ContainerImageTags="$tag;latest"
+37 -6
View File
@@ -8,28 +8,55 @@ 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 }}
REF_NAME: ${{ gitea.ref_name }}
REPOSITORY: ${{ gitea.repository }}
jobs:
pack-and-push:
runs-on: ubuntu-latest
container:
image: mcr-mirror.liara.ir/dotnet/sdk:10.0
image: mcr-mirror.liara.ir/dotnet/sdk:10.0.202
steps:
- name: Checkout
uses: actions/checkout@v4
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
@@ -64,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
@@ -71,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
View File
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/sdk:10.0 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.microsoft.com/dotnet/aspnet:10.0 AS final
FROM mcr-mirror.liara.ir/dotnet/aspnet:10.0 AS final
WORKDIR /app
ENV ASPNETCORE_URLS=http://+:8080 \