Skip to content

Instantly share code, notes, and snippets.

@jkeam
Created August 4, 2023 21:18
Show Gist options
  • Save jkeam/bab04e95f1f6cbc2ff71a20bbd898bcf to your computer and use it in GitHub Desktop.
Save jkeam/bab04e95f1f6cbc2ff71a20bbd898bcf to your computer and use it in GitHub Desktop.
Dotnet Publish Task
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: dotnet-build-publish
namespace: dotnet
spec:
steps:
- env:
- name: WORKSPACE_SSL_CA_DIRECTORY_BOUND
value: $(workspaces.ssl-ca-directory.bound)
- name: WORKSPACE_SSL_CA_DIRECTORY_PATH
value: $(workspaces.ssl-ca-directory.path)
image: registry.access.redhat.com/ubi8/dotnet-60:6.0-37
name: dotnet-build-publish
resources: {}
script: |
#!/usr/bin/bash
echo "dotnet building..."
dotnet build
echo "dotnet packing..."
dotnet pack
echo 'adding certs...'
if [ "${WORKSPACE_SSL_CA_DIRECTORY_BOUND}" = "true" ]
then
cp -R "${WORKSPACE_SSL_CA_DIRECTORY_PATH}/." /usr/share/pki/ca-trust-source/anchors/
update-ca-trust
fi
echo 'adding source...'
dotnet nuget add source https://pkgs.dev.azure.com/repo/repo/_packaging/test/nuget/v3/index.json -n azure -u <[email protected]> -p <personal_access_token> --store-password-in-clear-text --valid-authentication-types basic
echo 'pushing...'
dotnet nuget push ./bin/Debug/*.nupkg --source azure --api-key az
securityContext:
runAsUser: 0
workingDir: $(workspaces.source.path)
workspaces:
- name: source
- name: ssl-ca-directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment