Skip to content

Commit

Permalink
Used universal artifact instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Jie Chen committed Jan 9, 2025
1 parent e651d24 commit c16f959
Showing 1 changed file with 57 additions and 50 deletions.
107 changes: 57 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,58 +28,65 @@ jobs:
client-id: "930a0428-2b45-4cf9-9afe-b81bde516504"
tenant-id: "72f988bf-86f1-41af-91ab-2d7cd011db47"
allow-no-subscriptions: true

- name: Create Nuget Configuration File
shell: bash
run: |
FEED=${{ env.FEED_URL }}
PACKAGE_NAME=$(echo $FEED | grep -oP '(?<=_packaging/)[^/]+')
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
if [[ $FEED == *"nuget/v3/index.json"* ]]; then
NUGET_FEED=$FEED
else
NUGET_FEED=$FEED/nuget/v3/index.json
fi
echo "Creating nuget.config file"
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<configuration>
<packageSources>
<clear />
<add key=\"$PACKAGE_NAME\" value=\"$NUGET_FEED\" />
</packageSources>
</configuration>" > nuget.config
- name: Install Artifacts Credential Helper on Linux
shell: bash
run: |
sh -c "$(curl -fsSL https://aka.ms/install-artifacts-credprovider.sh)"
- name: Setup CFS Credentials
shell: bash
run: |
CFS_ACCESSTOKEN=$(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 | jq -r .accessToken)
echo "::add-mask::$CFS_ACCESSTOKEN"
echo "CFS_ACCESSTOKEN=$CFS_ACCESSTOKEN" >> $GITHUB_ENV
URI_PREFIX=$(echo ${{ env.FEED_URL }} | sed 's/_packaging.*//')
echo "VSS_NUGET_ACCESSTOKEN=$CFS_ACCESSTOKEN" >> $GITHUB_ENV
echo "VSS_NUGET_URI_PREFIXES=$URI_PREFIX" >> $GITHUB_ENV
- name: Setup .NET Core
uses: actions/setup-dotnet@v3

- name: Download artifact from feed
uses: azure/cli@v2
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
source-url: ${{ env.FEED_URL }}
env:
NUGET_AUTH_TOKEN: $VSS_NUGET_ACCESSTOKEN
azcliversion: latest
inlineScript: |
az artifacts universal download --organization "https://msazure.visualstudio.com/" --project "dcf1de98-e135-4121-8a6c-99b73705f581" --scope project --feed "ContainerPlat-Dev" --name "azurelinux-uvm" --version "0.0.7" --path .
# - name: Install Artifacts Credential Helper on Linux
# shell: bash
# run: |
# sh -c "$(curl -fsSL https://aka.ms/install-artifacts-credprovider.sh)"

# - name: Create Nuget Configuration File
# shell: bash
# run: |
# FEED=${{ env.FEED_URL }}
# PACKAGE_NAME=$(echo $FEED | grep -oP '(?<=_packaging/)[^/]+')
# echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
# if [[ $FEED == *"nuget/v3/index.json"* ]]; then
# NUGET_FEED=$FEED
# else
# NUGET_FEED=$FEED/nuget/v3/index.json
# fi
# echo "Creating nuget.config file"
# echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
# <configuration>
# <packageSources>
# <clear />
# <add key=\"$PACKAGE_NAME\" value=\"$NUGET_FEED\" />
# </packageSources>
# </configuration>" > nuget.config

# - name: Setup CFS Credentials
# shell: bash
# run: |
# CFS_ACCESSTOKEN=$(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 | jq -r .accessToken)
# echo "::add-mask::$CFS_ACCESSTOKEN"
# echo "CFS_ACCESSTOKEN=$CFS_ACCESSTOKEN" >> $GITHUB_ENV
# URI_PREFIX=$(echo ${{ env.FEED_URL }} | sed 's/_packaging.*//')
# echo "VSS_NUGET_ACCESSTOKEN=$CFS_ACCESSTOKEN" >> $GITHUB_ENV
# echo "VSS_NUGET_URI_PREFIXES=$URI_PREFIX" >> $GITHUB_ENV

# - name: Setup .NET Core
# uses: actions/setup-dotnet@v3
# with:
# dotnet-version: ${{ env.DOTNET_VERSION }}
# source-url: ${{ env.FEED_URL }}
# env:
# NUGET_AUTH_TOKEN: $VSS_NUGET_ACCESSTOKEN

- name: Dotnet add source
run: |
dotnet nuget add source ${{ env.FEED_URL }} \
--name $PACKAGE_NAME
- name: dotnet restore package
run: |
dotnet restore
# - name: Dotnet add source
# run: |
# dotnet nuget add source ${{ env.FEED_URL }} \
# --name $PACKAGE_NAME

# - name: dotnet restore package
# run: |
# dotnet restore

lint:
runs-on: [self-hosted, 1ES.Pool=containerplat-github-runner-pool-east-us-2, 1ES.ImageOverride=mms-ws2022-containers-enabled]
Expand Down

0 comments on commit c16f959

Please sign in to comment.