Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple bug fixes for github workflow #434

Merged
merged 6 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/actions-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
push:
branches:
- trunk
- feature/*
- hotfix/*
pull_request:
branches:
- trunk
Expand Down Expand Up @@ -126,11 +128,8 @@ jobs:
package-stage:
name: Package Management
needs: build-stage
# run from here only if it's not a a forked repo
# head.repo.full_name would be the forked repo name and 'github.repository' is equal to our repository
if: |
github.event.pull_request.head.repo.full_name == github.repository ||
github.ref == 'refs/heads/trunk'
# run from here only if it's not a pull request
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Download module
Expand Down Expand Up @@ -201,7 +200,7 @@ jobs:
- name: Module test installation
shell: pwsh
run: |
./Test-InstallFromLocalFeed.ps1 -GitHubToken $env:GITHUB_TOKEN -RunnerTempPath $RUNNER_TEMP
./Test-InstallFromLocalFeed.ps1 -GitHubToken $env:GITHUB_TOKEN -RunnerTempPath '${{ runner.temp }}'
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
working-directory: './tools/scripts'
Expand Down
7 changes: 5 additions & 2 deletions tools/scripts/Test-InstallFromLocalFeed.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ param (
$LocalPSGallery = "LocalPSGallery"
$moduleName = "VSTeam"

# turn of first time experience which shows verbose uneeded text in every job
$env:DOTNET_NOLOGO = $true
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = $true

Write-Host "`n##### Download module and all it's dependencies"
dotnet nuget add source --username USERNAME --password $GitHubToken --store-password-in-clear-text --name GitHub-VSTeam "https://nuget.pkg.github.com/MethodsAndPractices/index.json"
nuget install $moduleName -Source GitHub-VSTeam -OutputDirectory "$RunnerTempPath/install"


# rename folders by removing version tag from the folder name
$moduleFolders = Get-ChildItem "$RunnerTempPath/install" -Directory
$modulesToPublish = @()
New-Item -Path "$RunnerTempPath/repo" -Type Directory | Out-Null
foreach ($folder in $moduleFolders) {
$shortName = $folder.Name -replace '(.*)(\.\d+){3,4}', '$1'
$shortName = $folder.Name -replace '((\.\d+){3,4})', ''
Move-Item -Path "$RunnerTempPath/install/$($folder.Name)" -Destination "$RunnerTempPath/install/$($shortName)"
$modulesToPublish += $shortName
}
Expand Down