11name : linux_packaging
2- description : ' Test very basic Linux packaging'
3-
4- # This isn't working yet
5- # It fails with
6-
7- # ERROR: While executing gem ... (Gem::FilePermissionError)
8- # You don't have write permissions for the /var/lib/gems/2.7.0 directory.
9- # WARNING: Installation of gem dotenv 2.8.1 failed! Must resolve manually.
2+ description : ' Linux packaging for PowerShell'
103
114runs :
125 using : composite
158 if : success() || failure()
169 run : ' Get-ChildItem -Path env: | Out-String -width 9999 -Stream | write-Verbose -Verbose'
1710 shell : pwsh
11+
12+ - uses : actions/setup-dotnet@v5
13+ with :
14+ global-json-file : ./global.json
15+
1816 - name : Download Build Artifacts
1917 uses : actions/download-artifact@v4
2018 with :
21- path : " ${{ github.workspace }}"
19+ name : build
20+ path : " ${{ runner.workspace }}/build"
21+
2222 - name : Capture Artifacts Directory
2323 continue-on-error : true
24- run : Get-ChildItem "${{ github .workspace }}/build/*" -Recurse
24+ run : Get-ChildItem "${{ runner .workspace }}/build/*" -Recurse
2525 shell : pwsh
2626
2727 - name : Bootstrap
2828 run : |-
2929 Import-Module ./build.psm1
3030 Start-PSBootstrap -Scenario Package
31+ Write-Verbose -Verbose "Start Sync-PSTags"
32+ Sync-PSTags -AddRemoteIfMissing
33+ Write-Verbose -Verbose "End Sync-PSTags"
3134 shell : pwsh
32- - name : Capture Artifacts Directory
33- continue-on-error : true
34- run : Import-Module ./build.psm1
35+
36+ - name : Extract Build ZIP
37+ run : |-
38+ $destinationFolder = "${{ runner.workspace }}/bins"
39+ $archiveFile = "${{ runner.workspace }}/build/build.zip"
40+
41+ Write-Verbose "Extracting $archiveFile to $destinationFolder" -Verbose
42+ New-Item -ItemType Directory -Path $destinationFolder -Force | Out-Null
43+ Expand-Archive -Path $archiveFile -DestinationPath $destinationFolder -Force
3544 shell : pwsh
36- - name : Extract Files
37- uses : actions/github-script@v7.0.0
38- env :
39- DESTINATION_FOLDER : " ${{ github.workspace }}/bins"
40- ARCHIVE_FILE_PATTERNS : " ${{ github.workspace }}/build/build.zip"
41- with :
42- script : |-
43- const fs = require('fs').promises
44- const path = require('path')
45- const target = path.resolve(process.env.DESTINATION_FOLDER)
46- const patterns = process.env.ARCHIVE_FILE_PATTERNS
47- const globber = await glob.create(patterns)
48- await io.mkdirP(path.dirname(target))
49- for await (const file of globber.globGenerator()) {
50- if ((await fs.lstat(file)).isDirectory()) continue
51- await exec.exec(`7z x ${file} -o${target} -aoa`)
52- }
45+
5346 - name : Fix permissions
5447 continue-on-error : true
5548 run : |-
56- find "${{ github .workspace }}/bins" -type d -exec chmod +rwx {} \;
57- find "${{ github .workspace }}/bins" -type f -exec chmod +rw {} \;
49+ find "${{ runner .workspace }}/bins" -type d -exec chmod +rwx {} \;
50+ find "${{ runner .workspace }}/bins" -type f -exec chmod +rw {} \;
5851 shell : bash
52+
5953 - name : Capture Extracted Build ZIP
6054 continue-on-error : true
61- run : Get-ChildItem "${{ github .workspace }}/bins/*" -Recurse -ErrorAction SilentlyContinue
55+ run : Get-ChildItem "${{ runner .workspace }}/bins/*" -Recurse -ErrorAction SilentlyContinue
6256 shell : pwsh
63- - name : Packaging Tests
64- if : success()
57+
58+ - name : Create Packages
59+ env :
60+ BUILD_ARTIFACTSTAGINGDIRECTORY : ${{ runner.workspace }}/packages
6561 run : |-
62+ # Create the artifacts staging directory
63+ New-Item -ItemType Directory -Path "$env:BUILD_ARTIFACTSTAGINGDIRECTORY" -Force | Out-Null
64+
6665 Import-Module ./tools/ci.psm1
67- Restore-PSOptions -PSOptionsPath '${{ github .workspace }}/build/psoptions.json'
66+ Restore-PSOptions -PSOptionsPath '${{ runner .workspace }}/build/psoptions.json'
6867 $options = (Get-PSOptions)
69- $rootPath = '${{ github .workspace }}/bins'
68+ $rootPath = '${{ runner .workspace }}/bins'
7069 $originalRootPath = Split-Path -path $options.Output
7170 $path = Join-Path -path $rootPath -ChildPath (split-path -leaf -path $originalRootPath)
7271 $pwshPath = Join-Path -path $path -ChildPath 'pwsh'
@@ -75,21 +74,24 @@ runs:
7574 Set-PSOptions $options
7675 Invoke-CIFinish
7776 shell : pwsh
78- - name : Upload packages
79- run : |-
80- Get-ChildItem "${env:BUILD_ARTIFACTSTAGINGDIRECTORY}/*.deb" -Recurse | ForEach-Object {
81- $packagePath = $_.FullName
82- Write-Host "Uploading $packagePath"
83- Write-Host "##vso[artifact.upload containerfolder=deb;artifactname=deb]$packagePath"
84- }
85- Get-ChildItem "${env:BUILD_ARTIFACTSTAGINGDIRECTORY}/*.rpm" -Recurse | ForEach-Object {
86- $packagePath = $_.FullName
87- Write-Host "Uploading $packagePath"
88- Write-Host "##vso[artifact.upload containerfolder=rpm;artifactname=rpm]$packagePath"
89- }
90- Get-ChildItem "${env:BUILD_ARTIFACTSTAGINGDIRECTORY}/*.tar.gz" -Recurse | ForEach-Object {
91- $packagePath = $_.FullName
92- Write-Host "Uploading $packagePath"
93- Write-Host "##vso[artifact.upload containerfolder=rpm;artifactname=rpm]$packagePath"
94- }
95- shell : pwsh
77+
78+ - name : Upload deb packages
79+ uses : actions/upload-artifact@v4
80+ with :
81+ name : packages-deb
82+ path : ${{ runner.workspace }}/packages/*.deb
83+ if-no-files-found : ignore
84+
85+ - name : Upload rpm packages
86+ uses : actions/upload-artifact@v4
87+ with :
88+ name : packages-rpm
89+ path : ${{ runner.workspace }}/packages/*.rpm
90+ if-no-files-found : ignore
91+
92+ - name : Upload tar.gz packages
93+ uses : actions/upload-artifact@v4
94+ with :
95+ name : packages-tar
96+ path : ${{ runner.workspace }}/packages/*.tar.gz
97+ if-no-files-found : ignore
0 commit comments