Using goreleaser as the publishing mechanism for Windows binaries (#6975)
This commit is contained in:
parent
b4323ea437
commit
f68b583831
8
.github/workflows/master.yml
vendored
8
.github/workflows/master.yml
vendored
|
@ -287,14 +287,6 @@ jobs:
|
|||
run: |
|
||||
cd src\github.com\${{ github.repository }}
|
||||
dotnet msbuild /t:Tests /v:Detailed build.proj /p:PulumiRoot="D:\\Pulumi"
|
||||
- name: Publish Binary
|
||||
run: |
|
||||
cd src\github.com\${{ github.repository }}
|
||||
dotnet msbuild /t:Publish /v:Detailed build.proj /p:PulumiRoot="D:\\Pulumi"
|
||||
- run: |
|
||||
cd src\github.com\${{ github.repository }}
|
||||
git status
|
||||
git --no-pager diff
|
||||
verify-containers:
|
||||
name: Run Container Tests
|
||||
needs: [publish-binaries, publish-sdks]
|
||||
|
|
10
.github/workflows/prerelease.yml
vendored
10
.github/workflows/prerelease.yml
vendored
|
@ -78,7 +78,7 @@ jobs:
|
|||
publish-binaries:
|
||||
name: Publish Binaries
|
||||
runs-on: macos-latest
|
||||
needs: [build-and-test, windows-release]
|
||||
needs: [build-and-test, windows-build]
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.16.x ]
|
||||
|
@ -200,8 +200,8 @@ jobs:
|
|||
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
|
||||
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
|
||||
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
|
||||
windows-release:
|
||||
name: Windows Build + Release
|
||||
windows-build:
|
||||
name: Windows Build
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.16.x ]
|
||||
|
@ -279,10 +279,10 @@ jobs:
|
|||
cd tests
|
||||
go mod download
|
||||
popd
|
||||
- name: Publish Binary
|
||||
- name: Build Binary
|
||||
run: |
|
||||
cd src\github.com\${{ github.repository }}
|
||||
dotnet msbuild /t:ReleaseProcess /v:Detailed build.proj /p:PulumiRoot="D:\\Pulumi"
|
||||
dotnet msbuild /t:Build /v:Detailed build.proj /p:PulumiRoot="D:\\Pulumi"
|
||||
verify-containers:
|
||||
name: Run Container Tests
|
||||
needs: [publish-binaries, publish-sdks]
|
||||
|
|
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
|
@ -173,7 +173,7 @@ jobs:
|
|||
publish-binaries:
|
||||
name: Publish Binaries
|
||||
runs-on: macos-latest
|
||||
needs: [build-and-test, windows-release]
|
||||
needs: [build-and-test, windows-build]
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.16.x ]
|
||||
|
@ -295,8 +295,8 @@ jobs:
|
|||
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
|
||||
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
|
||||
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
|
||||
windows-release:
|
||||
name: Windows Build + Release
|
||||
windows-build:
|
||||
name: Windows Build
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.16.x]
|
||||
|
@ -374,10 +374,10 @@ jobs:
|
|||
cd tests
|
||||
go mod download
|
||||
popd
|
||||
- name: Publish Binary
|
||||
- name: Build Binary
|
||||
run: |
|
||||
cd src\github.com\${{ github.repository }}
|
||||
dotnet msbuild /t:ReleaseProcess /v:Detailed build.proj /p:PulumiRoot="D:\\Pulumi"
|
||||
dotnet msbuild /t:Build /v:Detailed build.proj /p:PulumiRoot="D:\\Pulumi"
|
||||
verify-containers:
|
||||
name: Run Container Tests
|
||||
needs: [publish-binaries, publish-sdks]
|
||||
|
|
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -38,3 +38,9 @@ pulumi-resource-pulumi-python
|
|||
pulumi-analyzer-policy
|
||||
pulumi-analyzer-policy-python
|
||||
pulumi-language-python-exec
|
||||
pulumi-resource-pulumi-nodejs.cmd
|
||||
pulumi-resource-pulumi-python.cmd
|
||||
pulumi-python3-shim.cmd
|
||||
pulumi-python-shim.cmd
|
||||
pulumi-analyzer-policy.cmd
|
||||
pulumi-analyzer-policy-python.cmd
|
||||
|
|
|
@ -18,6 +18,57 @@ release:
|
|||
changelog:
|
||||
skip: true
|
||||
builds:
|
||||
# Windows builds
|
||||
- id: pulumi-windows
|
||||
binary: pulumi
|
||||
dir: pkg
|
||||
goarch:
|
||||
- amd64
|
||||
goos:
|
||||
- windows
|
||||
ldflags:
|
||||
- -X github.com/pulumi/pulumi/pkg/v3/version.Version={{.Tag}}
|
||||
main: ./cmd/pulumi
|
||||
- id: pulumi-language-nodejs-windows
|
||||
binary: pulumi-language-nodejs
|
||||
dir: sdk
|
||||
goarch:
|
||||
- amd64
|
||||
goos:
|
||||
- windows
|
||||
ldflags:
|
||||
- -X github.com/pulumi/pulumi/pkg/v3/version.Version={{.Tag}}
|
||||
main: ./nodejs/cmd/pulumi-language-nodejs
|
||||
- id: pulumi-language-python-windows
|
||||
binary: pulumi-language-python
|
||||
dir: sdk
|
||||
goarch:
|
||||
- amd64
|
||||
goos:
|
||||
- windows
|
||||
ldflags:
|
||||
- -X github.com/pulumi/pulumi/pkg/v3/version.Version={{.Tag}}
|
||||
main: ./python/cmd/pulumi-language-python
|
||||
- id: pulumi-language-dotnet-windows
|
||||
binary: pulumi-language-dotnet
|
||||
dir: sdk
|
||||
goarch:
|
||||
- amd64
|
||||
goos:
|
||||
- windows
|
||||
ldflags:
|
||||
- -X github.com/pulumi/pulumi/pkg/v3/version.Version={{.Tag}}
|
||||
main: ./dotnet/cmd/pulumi-language-dotnet
|
||||
- id: pulumi-language-go-windows
|
||||
binary: pulumi-language-go
|
||||
dir: sdk
|
||||
goarch:
|
||||
- amd64
|
||||
goos:
|
||||
- windows
|
||||
ldflags:
|
||||
- -X github.com/pulumi/pulumi/pkg/v3/version.Version={{.Tag}}
|
||||
main: ./go/pulumi-language-go
|
||||
# UNIX builds
|
||||
- id: pulumi-unix
|
||||
binary: pulumi
|
||||
|
@ -99,6 +150,26 @@ archives:
|
|||
- pulumi-analyzer-policy-python
|
||||
- pulumi-language-python-exec
|
||||
name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
|
||||
- id: pulumi-windows
|
||||
wrap_in_directory: pulumi/bin
|
||||
builds:
|
||||
- pulumi-language-dotnet-windows
|
||||
- pulumi-language-go-windows
|
||||
- pulumi-language-python-windows
|
||||
- pulumi-language-nodejs-windows
|
||||
- pulumi-windows
|
||||
replacements:
|
||||
amd64: x64
|
||||
format: zip
|
||||
files:
|
||||
- pulumi-resource-pulumi-nodejs.cmd
|
||||
- pulumi-resource-pulumi-python.cmd
|
||||
- pulumi-python3-shim.cmd
|
||||
- pulumi-python-shim.cmd
|
||||
- pulumi-analyzer-policy.cmd
|
||||
- pulumi-analyzer-policy-python.cmd
|
||||
- pulumi-language-python-exec
|
||||
name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
|
||||
snapshot:
|
||||
name_template: "{{ .Version }}-SNAPSHOT"
|
||||
checksum:
|
||||
|
|
|
@ -13,6 +13,57 @@ blobs:
|
|||
provider: s3
|
||||
region: us-west-2
|
||||
builds:
|
||||
# Windows builds
|
||||
- id: pulumi-windows
|
||||
binary: pulumi
|
||||
dir: pkg
|
||||
goarch:
|
||||
- amd64
|
||||
goos:
|
||||
- windows
|
||||
ldflags:
|
||||
- -X github.com/pulumi/pulumi/pkg/v3/version.Version={{.Tag}}
|
||||
main: ./cmd/pulumi
|
||||
- id: pulumi-language-nodejs-windows
|
||||
binary: pulumi-language-nodejs
|
||||
dir: sdk
|
||||
goarch:
|
||||
- amd64
|
||||
goos:
|
||||
- windows
|
||||
ldflags:
|
||||
- -X github.com/pulumi/pulumi/pkg/v3/version.Version={{.Tag}}
|
||||
main: ./nodejs/cmd/pulumi-language-nodejs
|
||||
- id: pulumi-language-python-windows
|
||||
binary: pulumi-language-python
|
||||
dir: sdk
|
||||
goarch:
|
||||
- amd64
|
||||
goos:
|
||||
- windows
|
||||
ldflags:
|
||||
- -X github.com/pulumi/pulumi/pkg/v3/version.Version={{.Tag}}
|
||||
main: ./python/cmd/pulumi-language-python
|
||||
- id: pulumi-language-dotnet-windows
|
||||
binary: pulumi-language-dotnet
|
||||
dir: sdk
|
||||
goarch:
|
||||
- amd64
|
||||
goos:
|
||||
- windows
|
||||
ldflags:
|
||||
- -X github.com/pulumi/pulumi/pkg/v3/version.Version={{.Tag}}
|
||||
main: ./dotnet/cmd/pulumi-language-dotnet
|
||||
- id: pulumi-language-go-windows
|
||||
binary: pulumi-language-go
|
||||
dir: sdk
|
||||
goarch:
|
||||
- amd64
|
||||
goos:
|
||||
- windows
|
||||
ldflags:
|
||||
- -X github.com/pulumi/pulumi/pkg/v3/version.Version={{.Tag}}
|
||||
main: ./go/pulumi-language-go
|
||||
# UNIX builds
|
||||
- id: pulumi-unix
|
||||
binary: pulumi
|
||||
|
@ -75,10 +126,9 @@ builds:
|
|||
- -X github.com/pulumi/pulumi/pkg/v3/version.Version={{.Tag}}
|
||||
main: ./go/pulumi-language-go
|
||||
|
||||
|
||||
archives:
|
||||
- id: pulumi-unix
|
||||
wrap_in_directory: "pulumi"
|
||||
wrap_in_directory: pulumi
|
||||
builds:
|
||||
- pulumi-language-dotnet-unix
|
||||
- pulumi-language-go-unix
|
||||
|
@ -94,6 +144,26 @@ archives:
|
|||
- pulumi-analyzer-policy-python
|
||||
- pulumi-language-python-exec
|
||||
name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
|
||||
- id: pulumi-windows
|
||||
wrap_in_directory: pulumi/bin
|
||||
builds:
|
||||
- pulumi-language-dotnet-windows
|
||||
- pulumi-language-go-windows
|
||||
- pulumi-language-python-windows
|
||||
- pulumi-language-nodejs-windows
|
||||
- pulumi-windows
|
||||
replacements:
|
||||
amd64: x64
|
||||
format: zip
|
||||
files:
|
||||
- pulumi-resource-pulumi-nodejs.cmd
|
||||
- pulumi-resource-pulumi-python.cmd
|
||||
- pulumi-python3-shim.cmd
|
||||
- pulumi-python-shim.cmd
|
||||
- pulumi-analyzer-policy.cmd
|
||||
- pulumi-analyzer-policy-python.cmd
|
||||
- pulumi-language-python-exec
|
||||
name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
|
||||
snapshot:
|
||||
name_template: "{{ .Version }}-SNAPSHOT"
|
||||
checksum:
|
||||
|
|
19
build.proj
19
build.proj
|
@ -258,18 +258,6 @@
|
|||
DependsOnTargets="BuildDotNetSDK;BuildGoSDK;BuildNodeJSSDK;BuildPythonSDK;InstallPulumiPlugin">
|
||||
</Target>
|
||||
|
||||
<!-- Release Build
|
||||
This is used to create the dependencies required for shipping the binary to the end user.
|
||||
In the old scripts `BuildNodeJSSDK` was called `BuildNodeSdk` and included tasks for
|
||||
* TypeScriptCompileNodeSdk (now called NodeJSBuild)
|
||||
* GoCompileNodeSdk (now called NodeJSBuild)
|
||||
* BinPlaceNodeSdk (included as part of NodeJSBuild)
|
||||
The old task `BuildGoCmds` has now been renamed to `InstallPulumiPlugin`
|
||||
-->
|
||||
<Target Name="ReleaseBuild"
|
||||
DependsOnTargets="BuildNodeJSSDK;InstallPulumiPlugin">
|
||||
</Target>
|
||||
|
||||
<!-- This is where we build and install the NodeJS SDK -->
|
||||
<Target Name="BuildTests"
|
||||
DependsOnTargets="TestDependencies;TestBuild">
|
||||
|
@ -337,13 +325,6 @@
|
|||
Condition="$(IntegrationTestExitCode) != 0"/>
|
||||
</Target>
|
||||
|
||||
<Target Name="Publish">
|
||||
<Exec Command=""$(MSBuildThisFileDirectory)\scripts\publish.cmd"" ConsoleToMSBuild="true" />
|
||||
</Target>
|
||||
|
||||
<Target Name="ReleaseProcess"
|
||||
DependsOnTargets="ReleaseBuild;Publish" />
|
||||
|
||||
<Target Name="CIBuild"
|
||||
DependsOnTargets="Build;Tests" />
|
||||
</Project>
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
@echo off
|
||||
powershell -noprofile -executionPolicy Unrestricted -file "%~dpn0.ps1" %*
|
|
@ -1,82 +0,0 @@
|
|||
param (
|
||||
$VersionTag,
|
||||
$PulumiRef
|
||||
)
|
||||
|
||||
Set-StrictMode -Version 2.0
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$S3ProdBucketRoot="s3://get.pulumi.com/releases/"
|
||||
$S3EngBucketRoot="s3://eng.pulumi.com/releases/"
|
||||
$S3PublishFolderSdk="${S3ProdBucketRoot}sdk/"
|
||||
|
||||
function New-TemporaryDirectory {
|
||||
New-Item -ItemType Directory -Path (Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName()))
|
||||
}
|
||||
|
||||
function New-TemporaryFile {
|
||||
New-Item -ItemType File -Path (Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName()))
|
||||
}
|
||||
|
||||
function Download-Release ($repoName, $repoCommit, [ValidateSet("zip", "tgz")]$ext) {
|
||||
Write-Host "downloading $repoName@$repoCommit"
|
||||
|
||||
$file="${repoCommit}.${ext}"
|
||||
$s3File="${S3EngBucketRoot}${repoName}/windows/amd64/${file}"
|
||||
|
||||
aws s3 cp --only-show-errors "$s3File" ".\$file"
|
||||
|
||||
switch($ext) {
|
||||
"zip" { 7z x ${file} }
|
||||
"tgz" { cmd /C "7z x ${file} -tgzip -so | 7z x -ttar -si" }
|
||||
default { Write-Error "Unknown extention type $ext" }
|
||||
}
|
||||
|
||||
Remove-Item -Force "$file"
|
||||
}
|
||||
|
||||
if (!$VersionTag) { $VersionTag=Get-Date -UFormat '%Y%m%d_%H%M%S' }
|
||||
if (!$PulumiRef) { $PulumiRef="master" }
|
||||
|
||||
$SdkFileName="pulumi-$($VersionTag -replace '\+.', '')-windows-x64.zip"
|
||||
|
||||
$PulumiFolder=(Join-Path (New-TemporaryDirectory) "Pulumi")
|
||||
|
||||
New-Item -ItemType Directory -Path $PulumiFolder | Out-Null
|
||||
|
||||
Push-Location "$PulumiFolder" | Out-Null
|
||||
|
||||
Write-Host "pulumi: $PulumiRef"
|
||||
Write-Host ""
|
||||
|
||||
Download-Release "pulumi" $PulumiRef "zip"
|
||||
|
||||
Remove-Item -Recurse -Force -Path "$PulumiFolder\node_modules"
|
||||
|
||||
$SdkPackagePath=(Join-Path ([System.IO.Path]::GetTempPath()) $SdkFileName)
|
||||
|
||||
if (Test-Path $SdkPackagePath) {
|
||||
Remove-Item -Force -Path $SdkPackagePath
|
||||
}
|
||||
|
||||
7z a -tzip "$SdkPackagePath" "$(Join-Path (Split-Path -Parent $PulumiFolder) '.')"
|
||||
|
||||
Write-Host "uploading SDK to ${S3PublishFolderSdk}${SdkFileName}"
|
||||
|
||||
$AWSCreds=((aws sts assume-role `
|
||||
--role-arn "arn:aws:iam::058607598222:role/UploadPulumiReleases" `
|
||||
--role-session-name "upload-sdk" `
|
||||
--external-id "upload-pulumi-release") | ConvertFrom-Json)
|
||||
|
||||
$env:AWS_ACCESS_KEY_ID=$AWSCreds.Credentials.AccessKeyId
|
||||
$env:AWS_SECRET_ACCESS_KEY=$AWSCreds.Credentials.SecretAccessKey
|
||||
$env:AWS_SECURITY_TOKEN=$AWSCreds.Credentials.SessionToken
|
||||
|
||||
aws s3 cp --acl public-read --only-show-errors "$SdkPackagePath" "${S3PublishFolderSdk}${SdkFileName}"
|
||||
|
||||
Pop-Location | Out-Null
|
||||
|
||||
Remove-Item -Path $SdkPackagePath
|
||||
Remove-Item -Path (Split-Path -Parent $PulumiFolder) -Force -Recurse
|
||||
|
||||
Write-Host "done"
|
|
@ -1,111 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Usage build-sdk.sh [version-tag] [pulumi-cloud-ref-name]
|
||||
#
|
||||
# version-tag defaults to current date and time
|
||||
# ref-name defaults to master (can be a branch or tag name)
|
||||
set -o nounset
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
readonly SCRIPT_DIR="$( cd "$( dirname "${0}" )" && pwd )"
|
||||
readonly S3_PROD_BUCKET_ROOT="s3://get.pulumi.com/releases"
|
||||
readonly S3_ENG_BUCKET_ROOT="s3://eng.pulumi.com/releases"
|
||||
readonly S3_PUBLISH_FOLDER_SDK="${S3_PROD_BUCKET_ROOT}/sdk"
|
||||
|
||||
# This function downloads a specific release and into the current working directory
|
||||
# usage: download_release <repo-name> <commitish>
|
||||
download_release() {
|
||||
local -r repo_name="${1}"
|
||||
local -r repo_commit="${2}"
|
||||
|
||||
echo "downloading ${repo_name}@${repo_commit}"
|
||||
|
||||
local -r file=${repo_commit}.tgz
|
||||
local -r s3_file=${S3_ENG_BUCKET_ROOT}/${repo_name}/${OS}/amd64/${file}
|
||||
|
||||
# Use AWS CLI to download the package corresponding to the component from S3 bucket
|
||||
if ! aws s3 cp --only-show-errors "${s3_file}" "./${file}" 2> /dev/null; then
|
||||
>&2 echo "failed to download ${s3_file}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# This function downloads and extracts a specific release and into the current working directory
|
||||
# usage: download_and_extract_release <repo-name> <commitish>
|
||||
download_and_extract_release() {
|
||||
local -r repo_name="${1}"
|
||||
local -r repo_commit="${2}"
|
||||
local -r file="${repo_commit}.tgz"
|
||||
|
||||
download_release "${repo_name}" "${repo_commit}"
|
||||
|
||||
if ! tar -xzf "${file}" 2> /dev/null; then
|
||||
>&2 echo "failed to untar ${file}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm "./${file}"
|
||||
}
|
||||
|
||||
# get the OS version
|
||||
OS=""
|
||||
case $(uname) in
|
||||
"Linux") OS=linux;;
|
||||
"Darwin") OS=darwin;;
|
||||
*) echo "error: unknown host os $(uname)" ; exit 1;;
|
||||
esac
|
||||
|
||||
readonly SDK_FILENAME=pulumi-${1:-$(date +"%Y%m%d_%H%M%S")}-${OS}-x64.tar.gz
|
||||
readonly PULUMI_REF=${2:-master}
|
||||
|
||||
# setup temporary folder to process the package
|
||||
readonly PULUMI_FOLDER=$(mktemp -d)/pulumi
|
||||
mkdir -p "${PULUMI_FOLDER}"
|
||||
|
||||
cd "${PULUMI_FOLDER}"
|
||||
|
||||
download_and_extract_release pulumi "${PULUMI_REF}"
|
||||
|
||||
# All node packages are now delivered via npm, so remove the node_modules folder.
|
||||
rm -rf "${PULUMI_FOLDER}/node_modules"
|
||||
|
||||
# Promote the binaries to the top level and delete the bin folder.
|
||||
mv "${PULUMI_FOLDER}/bin"/* "${PULUMI_FOLDER}/"
|
||||
rm -rf "${PULUMI_FOLDER}/bin"
|
||||
|
||||
readonly SDK_PACKAGE_PATH=$(mktemp)
|
||||
|
||||
echo "compressing package to ${SDK_PACKAGE_PATH}"
|
||||
|
||||
cd ..
|
||||
|
||||
if ! tar -zcf "${SDK_PACKAGE_PATH}" pulumi; then
|
||||
>&2 echo "failed to compress package"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "${SDK_PACKAGE_PATH}"
|
||||
# rel.pulumi.com is in our production account, so assume that role first.
|
||||
readonly CREDS_JSON=$(aws sts assume-role \
|
||||
--role-arn "arn:aws:iam::058607598222:role/UploadPulumiReleases" \
|
||||
--role-session-name "upload-sdk" \
|
||||
--external-id "upload-pulumi-release")
|
||||
|
||||
# Extract the assumed role's credentials into specific env vars.
|
||||
AWS_ACCESS_KEY_ID=$(echo "${CREDS_JSON}" | jq ".Credentials.AccessKeyId" --raw-output)
|
||||
export AWS_ACCESS_KEY_ID
|
||||
|
||||
AWS_SECRET_ACCESS_KEY=$(echo "${CREDS_JSON}" | jq ".Credentials.SecretAccessKey" --raw-output)
|
||||
export AWS_SECRET_ACCESS_KEY
|
||||
|
||||
AWS_SECURITY_TOKEN=$(echo "${CREDS_JSON}" | jq ".Credentials.SessionToken" --raw-output)
|
||||
export AWS_SECURITY_TOKEN
|
||||
|
||||
aws s3 cp --acl public-read --only-show-errors "${SDK_PACKAGE_PATH}" "${S3_PUBLISH_FOLDER_SDK}/${SDK_FILENAME}"
|
||||
|
||||
rm "${SDK_PACKAGE_PATH}"
|
||||
rm -rf "${PULUMI_FOLDER:?}"
|
||||
|
||||
echo "done"
|
||||
|
||||
exit 0
|
|
@ -1,56 +0,0 @@
|
|||
# make_release.ps1 will create a build package ready for publishing.
|
||||
Set-StrictMode -Version 2.0
|
||||
$ErrorActionPreference="Stop"
|
||||
|
||||
$Root=Join-Path $PSScriptRoot ".."
|
||||
$PublishDir=New-Item -ItemType Directory -Path "$env:TEMP\$([System.IO.Path]::GetRandomFileName())"
|
||||
$GitHash=$(git rev-parse HEAD)
|
||||
$PublishFile="$(Split-Path -Parent -Path $PublishDir)\$GitHash.zip"
|
||||
$Version = $(pulumictl get version)
|
||||
$Branch = $(if (Test-Path env:APPVEYOR_REPO_BRANCH) { $env:APPVEYOR_REPO_BRANCH } else { $(git rev-parse --abbrev-ref HEAD) })
|
||||
$PublishTargets = @($GitHash, $Version, $Branch)
|
||||
|
||||
function RunGoBuild($goPackage, $dir, $outputName) {
|
||||
$binRoot = New-Item -ItemType Directory -Force -Path "$PublishDir\bin"
|
||||
Push-Location $dir
|
||||
go build -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=v$Version" -o "$binRoot\$outputName" $goPackage
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
function CopyPackage($pathToModule, $moduleName) {
|
||||
$moduleRoot = New-Item -ItemType Directory -Force -Path "$PublishDir\node_modules\$moduleName"
|
||||
Copy-Item -Recurse $pathToModule\* $moduleRoot
|
||||
if (Test-Path "$moduleRoot\node_modules") {
|
||||
Remove-Item -Recurse -Force "$moduleRoot\node_modules"
|
||||
}
|
||||
if (Test-Path "$moduleRoot\tests") {
|
||||
Remove-Item -Recurse -Force "$moduleRoot\tests"
|
||||
}
|
||||
}
|
||||
|
||||
RunGoBuild "github.com/pulumi/pulumi/pkg/v3/cmd/pulumi" "pkg" "pulumi.exe"
|
||||
RunGoBuild "github.com/pulumi/pulumi/sdk/v3/nodejs/cmd/pulumi-language-nodejs" "sdk" "pulumi-language-nodejs.exe"
|
||||
RunGoBuild "github.com/pulumi/pulumi/sdk/v3/python/cmd/pulumi-language-python" "sdk" "pulumi-language-python.exe"
|
||||
RunGoBuild "github.com/pulumi/pulumi/sdk/v3/dotnet/cmd/pulumi-language-dotnet" "sdk" "pulumi-language-dotnet.exe"
|
||||
RunGoBuild "github.com/pulumi/pulumi/sdk/v3/go/pulumi-language-go" "sdk" "pulumi-language-go.exe"
|
||||
CopyPackage "$Root\sdk\nodejs\bin" "pulumi"
|
||||
|
||||
Copy-Item "$Root\sdk\nodejs\dist\pulumi-resource-pulumi-nodejs.cmd" "$PublishDir\bin"
|
||||
Copy-Item "$Root\sdk\python\dist\pulumi-python-shim.cmd" "$PublishDir\bin"
|
||||
Copy-Item "$Root\sdk\python\dist\pulumi-python3-shim.cmd" "$PublishDir\bin"
|
||||
Copy-Item "$Root\sdk\python\dist\pulumi-resource-pulumi-python.cmd" "$PublishDir\bin"
|
||||
Copy-Item "$Root\sdk\nodejs\dist\pulumi-analyzer-policy.cmd" "$PublishDir\bin"
|
||||
Copy-Item "$Root\sdk\python\dist\pulumi-analyzer-policy-python.cmd" "$PublishDir\bin"
|
||||
Copy-Item "$Root\sdk\python\cmd\pulumi-language-python-exec" "$PublishDir\bin"
|
||||
|
||||
# By default, if the archive already exists, 7zip will just add files to it, so blow away the existing
|
||||
# archive if it exists.
|
||||
if (Test-Path $PublishFile) {
|
||||
Remove-Item -Force $PublishFile
|
||||
}
|
||||
|
||||
7z a "$PublishFile" "$PublishDir\." | Out-Null
|
||||
|
||||
Remove-Item -Recurse -Force $PublishDir
|
||||
|
||||
New-Object PSObject -Property @{ArchivePath=$PublishFile;Targets=$PublishTargets}
|
|
@ -1,74 +0,0 @@
|
|||
#!/bin/bash
|
||||
# make_release.sh will create a build package ready for publishing.
|
||||
set -o nounset
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
readonly ROOT=$(dirname "${0}")/..
|
||||
readonly PUBDIR=$(mktemp -d)
|
||||
readonly GITHASH=$(git rev-parse HEAD)
|
||||
readonly PUBFILE=$(dirname "${PUBDIR})/${GITHASH}.tgz")
|
||||
readonly VERSION=$(pulumictl get version)
|
||||
|
||||
echo $VERSION
|
||||
exit 1
|
||||
|
||||
# Figure out which branch we're on. Prefer $TRAVIS_BRANCH, if set, since
|
||||
# Travis leaves us at detached HEAD and `git rev-parse` just returns "HEAD".
|
||||
readonly BRANCH=${TRAVIS_BRANCH:-$(git rev-parse --abbrev-ref HEAD)}
|
||||
declare -a PUBTARGETS=(${GITHASH} ${VERSION} ${BRANCH})
|
||||
|
||||
# usage: run_go_build <path-to-package-to-build>
|
||||
run_go_build() {
|
||||
local bin_suffix=""
|
||||
local -r output_name=$(basename $(cd "${1}" ; pwd))
|
||||
if [ "$(go env GOOS)" = "windows" ]; then
|
||||
bin_suffix=".exe"
|
||||
fi
|
||||
|
||||
mkdir -p "${PUBDIR}/bin"
|
||||
pushd "$2" > /dev/null && go build \
|
||||
-ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" \
|
||||
-o "${PUBDIR}/bin/${output_name}${bin_suffix}" \
|
||||
"$1"
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
# usage: copy_package <path-to-module> <module-name>
|
||||
copy_package() {
|
||||
local -r module_root="${PUBDIR}/node_modules/${2}"
|
||||
|
||||
mkdir -p "${module_root}"
|
||||
cp -r "${1}" "${module_root}/"
|
||||
if [[ -e "${module_root}/node_modules" ]]; then
|
||||
rm -rf "${module_root}/node_modules"
|
||||
fi
|
||||
if [[ -e "${module_root}/tests" ]]; then
|
||||
rm -rf "${module_root}/tests"
|
||||
fi
|
||||
}
|
||||
|
||||
readonly PULUMI_ROOT=$PWD
|
||||
|
||||
# Build binaries
|
||||
run_go_build "${PULUMI_ROOT}/pkg/cmd/pulumi" "pkg"
|
||||
run_go_build "${PULUMI_ROOT}/sdk/nodejs/cmd/pulumi-language-nodejs" "sdk"
|
||||
run_go_build "${PULUMI_ROOT}/sdk/python/cmd/pulumi-language-python" "sdk"
|
||||
run_go_build "${PULUMI_ROOT}/sdk/dotnet/cmd/pulumi-language-dotnet" "sdk"
|
||||
run_go_build "${PULUMI_ROOT}/sdk/go/pulumi-language-go" "sdk"
|
||||
|
||||
# Copy over the language and dynamic resource providers.
|
||||
cp "${ROOT}/sdk/nodejs/dist/pulumi-resource-pulumi-nodejs" "${PUBDIR}/bin/"
|
||||
cp "${ROOT}/sdk/python/dist/pulumi-resource-pulumi-python" "${PUBDIR}/bin/"
|
||||
cp "${ROOT}/sdk/nodejs/dist/pulumi-analyzer-policy" "${PUBDIR}/bin/"
|
||||
cp "${ROOT}/sdk/python/dist/pulumi-analyzer-policy-python" "${PUBDIR}/bin/"
|
||||
cp "${ROOT}/sdk/python/cmd/pulumi-language-python-exec" "${PUBDIR}/bin/"
|
||||
|
||||
# Copy packages
|
||||
copy_package "${ROOT}/sdk/nodejs/bin/." "@pulumi/pulumi"
|
||||
|
||||
# Tar up the file and then print it out for use by the caller or script.
|
||||
tar -czf "${PUBFILE}" -C ${PUBDIR} .
|
||||
echo ${PUBFILE} ${PUBTARGETS[@]}
|
||||
|
||||
exit 0
|
|
@ -11,8 +11,13 @@ go mod download
|
|||
popd
|
||||
|
||||
cp sdk/nodejs/dist/pulumi-resource-pulumi-nodejs .
|
||||
cp sdk/nodejs/dist/pulumi-resource-pulumi-nodejs .
|
||||
cp sdk/nodejs/dist/pulumi-resource-pulumi-nodejs.cmd .
|
||||
cp sdk/python/dist/pulumi-resource-pulumi-python .
|
||||
cp sdk/python/dist/pulumi-resource-pulumi-python.cmd .
|
||||
cp sdk/python/dist/pulumi-python3-shim.cmd .
|
||||
cp sdk/python/dist/pulumi-python-shim.cmd .
|
||||
cp sdk/nodejs/dist/pulumi-analyzer-policy .
|
||||
cp sdk/nodejs/dist/pulumi-analyzer-policy.cmd .
|
||||
cp sdk/python/dist/pulumi-analyzer-policy-python .
|
||||
cp sdk/python/dist/pulumi-analyzer-policy-python.cmd .
|
||||
cp sdk/python/cmd/pulumi-language-python-exec .
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
@echo off
|
||||
powershell -noprofile -executionPolicy Unrestricted -file "%~dpn0.ps1" %*
|
|
@ -1,20 +0,0 @@
|
|||
# publish.ps1 builds and publishes a release.
|
||||
Set-StrictMode -Version 2.0
|
||||
$ErrorActionPreference="Stop"
|
||||
|
||||
$PublishScript="$(go env GOPATH)\src\github.com\pulumi\scripts\ci\publish.ps1"
|
||||
$BuildSdkScript="$(go env GOPATH)\src\github.com\pulumi\pulumi\scripts\build-sdk.ps1"
|
||||
|
||||
if (!(Test-Path $PublishScript)) {
|
||||
Write-Error "Missing publish script at $PublishScript"
|
||||
}
|
||||
|
||||
$ReleaseInfo=& $PSScriptRoot\make_release.ps1
|
||||
|
||||
$PublishTargets=${ReleaseInfo}.Targets
|
||||
& $PublishScript $ReleaseInfo.ArchivePath "pulumi/windows/amd64" @PublishTargets
|
||||
|
||||
Remove-Item -Force $ReleaseInfo.ArchivePath
|
||||
|
||||
$Version = "v" + $(pulumictl get version)
|
||||
& $BuildSdkScript $Version "$(git rev-parse HEAD)"
|
|
@ -1,33 +0,0 @@
|
|||
#!/bin/bash
|
||||
# publish.sh builds and publishes the tarballs that our other repositories consume.
|
||||
set -o nounset
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
# We run multiple legs on Linux, but only want to publish the tgz's from the one that publishes
|
||||
# our NPM and PyPI packages. Otherwise, we may race with other legs when publishing to S3 which
|
||||
# leads to issues about values being out of range.
|
||||
if [ "${TRAVIS_OS_NAME:-}" = "linux" ] && [ "${TRAVIS_PUBLISH_PACKAGES:-}" != "true" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
readonly ROOT=$(dirname "${0}")/..
|
||||
readonly PUBLISH="${GOPATH}/src/github.com/pulumi/scripts/ci/publish.sh"
|
||||
readonly PUBLISH_GOARCH=("amd64")
|
||||
readonly PUBLISH_PROJECT="pulumi"
|
||||
|
||||
if [[ ! -f "${PUBLISH}" ]]; then
|
||||
>&2 echo "error: Missing publish script at $PUBLISH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readonly OS=$(go env GOOS)
|
||||
|
||||
echo "Publishing SDK build to s3://eng.pulumi.com/:"
|
||||
for ARCH in "${PUBLISH_GOARCH[@]}"; do
|
||||
export GOARCH="${ARCH}"
|
||||
RELEASE_INFO=($($(dirname "${0}")/make_release.sh))
|
||||
"${PUBLISH}" ${RELEASE_INFO[0]} "${PUBLISH_PROJECT}/${OS}/${ARCH}" ${RELEASE_INFO[@]:1}
|
||||
done
|
||||
|
||||
exit 0
|
Loading…
Reference in a new issue