Skip to content

Commit

Permalink
Merge pull request #36
Browse files Browse the repository at this point in the history
ksidirop/MAN-299-migrate-to-github-actions
  • Loading branch information
ksidirop-laerdal authored Apr 11, 2024
2 parents 2c6dce7 + 4bd2345 commit cff3d57
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#
# https://docs.github.com/en/actions/migrating-to-github-actions/automated-migrations/migrating-from-azure-devops-with-github-actions-importer#environment-variable-mapping
#
# bare in mind that variable substitution is not supported in github at all so we cant do stuff like this
#
# env:
# Build_Artifacts_Folderpath: $build_repository_folderpath/Artifacts
#

name: '🏗 📦 Build, Pack & Deploy Nugets'

Expand All @@ -11,10 +16,10 @@ env:
LAERDAL_REPOSITORY_PATH: ${{ github.repository }}

SCL_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SCL_NUGET_ORG_FEED_API_KEY: ${{ secrets.NUGET_ORG_FEED_API_KEY }}
SCL_AZURE_ARTIFACTS_API_KEY: ${{ secrets.SCL_AZURE_ARTIFACTS_API_KEY }}
SCL_GITHUB_NUGET_FEED_USERNAME: ${{ secrets.SCL_GITHUB_NUGET_FEED_USERNAME }}


on:
workflow_call: # so that other workflows can trigger this
workflow_dispatch: # allows to run this workflow manually from the actions tab
Expand All @@ -33,11 +38,7 @@ jobs:
build:

runs-on: 'windows-2022'

# variable substitution is not supported in github at all so we cant do stuff like this
#
# env:
# Build_Artifacts_Folderpath: $build_repository_folderpath/Artifacts
timeout-minutes: 5

steps:

Expand Down Expand Up @@ -102,3 +103,18 @@ jobs:
--source "https://nuget.pkg.github.com/Laerdal/index.json" \
--api-key "${{env.SCL_GITHUB_ACCESS_TOKEN}}" \
*nupkg
- name: '🚀 Publish to the Nuget.org' # https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry
shell: 'bash'
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
run: |
cd "${{env.BUILD_REPOSITORY_FOLDERPATH}}/Artifacts/" \
&& \
ls . \
&& \
dotnet \
nuget \
push \
--source "https://api.nuget.org/v3/index.json" \
--api-key "${{env.SCL_NUGET_ORG_FEED_API_KEY}}" \
*nupkg
8 changes: 4 additions & 4 deletions Laerdal.Scripts/Laerdal.Builder.targets
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
<!-- BUILD -->
<Target Name="BuildProjects">
<!-- REQUIRED PARAMETERS -->
<Error Condition=" '$(Laerdal_Project)' == '' " Text="'Laerdal_Project' has to be set. Please call this script again with the argument '/p:Laerdal_Project=...'" />

<Error Condition=" '$(Configuration)' == '' " Text="'Configuration' has to be set. Please call this script again with the argument '/p:Configuration=...'" />
<Error Condition=" '$(PackageOutputPath)' == '' " Text="'PackageOutputPath' has to be set. Please call this script again with the argument '/p:PackageOutputPath=...'" />
<Error Condition=" '$(Laerdal_Version_Base)' == '' " Text="'Laerdal_Version_Base' has to be set. Please call this script again with the argument '/p:Laerdal_Version_Base=...'" />

<!-- PARAMETERS -->
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>

<_Laerdal_Build_Parameters>$(_Laerdal_Build_Parameters);Configuration=$(Configuration)</_Laerdal_Build_Parameters>
<_Laerdal_Build_Parameters>$(_Laerdal_Build_Parameters);Laerdal_Version=$(Laerdal_Version_Base)</_Laerdal_Build_Parameters>
<_Laerdal_Build_Parameters>$(_Laerdal_Build_Parameters);PackageOutputPath=$(PackageOutputPath)</_Laerdal_Build_Parameters>
Expand Down
3 changes: 2 additions & 1 deletion Laerdal.Scripts/Laerdal.SetupBuildEnvironment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ dotnet nuget add \
source "${NUGET_FEED_URL}" \
--name "LaerdalMedical" \
--username "${NUGET_FEED_USERNAME}" \
--password "${NUGET_FEED_ACCESSTOKEN}"
--password "${NUGET_FEED_ACCESSTOKEN}" \
--store-password-in-clear-text
declare exitCode=$?
if [ $exitCode != 0 ]; then
echo "##vso[task.logissue type=error]Failed to add 'Laerdal Nuget Feed' as a nuget source."
Expand Down

0 comments on commit cff3d57

Please sign in to comment.