Skip to content

Commit

Permalink
Fix version stuff (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
UnstoppableMango authored Aug 19, 2024
1 parent 089adf4 commit be7edb6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 10 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,19 @@ jobs:
go-version-file: provider/go.mod
cache-dependency-path: provider/go.sum

- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
set-env: PROVIDER_VERSION

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: release
env:
GORELEASER_CURRENT_TAG: v${{ steps.version.outputs.version }}

- name: Upload binaries
uses: actions/upload-artifact@v4
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ jobs:
with:
pulumi-version-file: .versions/pulumi

- id: version
name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
set-env: PROVIDER_VERSION

- name: Install provider binary
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -143,3 +149,18 @@ jobs:
run: |
dotnet nuget push ${{ github.workspace }}/sdk/dotnet/bin/Debug/*.nupkg -s ${{ env.NUGET_FEED_URL }} -k ${{ env.NUGET_PUBLISH_KEY }}
echo "done publishing packages"
- if: ${{ matrix.language == 'go' && inputs.release }}
name: Publish Go SDK
uses: pulumi/publish-go-sdk-action@v1
with:
repository: ${{ github.repository }}
base-ref: ${{ github.sha }}
source: sdk
path: sdk
version: ${{ steps.version.outputs.version }}
additive: false
files: |-
go.*
go/**
!*.tar.gz
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ NUGET_PKG_NAME := UnMango.Baremetal
PROVISIONER_NAME := baremetal-provisioner

PROVIDER := pulumi-resource-${PACK}
VERSION ?= $(shell pulumictl get version --language generic)
SUPPORTED_SDKS := dotnet go nodejs python
PROTO_VERSION := v1alpha1
PROVIDER_PATH := provider
VERSION_PATH := ${PROVIDER_PATH}.Version
DOCKER_TAG ?= $(shell cut -d'.' -f-3 <<<'${VERSION}' | sed 's/+dirty//')


PROVIDER_VERSION ?= 1.0.0-alpha.0+dev
VERSION_GENERIC = $(shell pulumictl convert-version --language generic --version "$(PROVIDER_VERSION)")
VERSION_PATH := ${PROVIDER_PATH}.Version
DOCKER_TAG ?= $(shell cut -d'.' -f-3 <<<'${VERSION_GENERIC}' | sed 's/+dirty//')

GOPATH := $(shell go env GOPATH)

Expand Down Expand Up @@ -62,7 +65,7 @@ provider_debug::
go -C ${PROVIDER_PATH} build \
-o $(WORKING_DIR)/bin/${PROVIDER} \
-gcflags="all=-N -l" \
-ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION}" \
-ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION_GENERIC}" \
$(PROJECT)/${PROVIDER_PATH}/cmd/$(PROVIDER)

test_all:: test_provider test_sdks
Expand All @@ -80,25 +83,25 @@ gen_examples: $(SUPPORTED_SDKS:%=.make/examples/%)
.PHONY: sdk/%
sdk/%: $(SCHEMA_FILE)
rm -rf $@
pulumi package gen-sdk --language $* $(SCHEMA_FILE) --version "${VERSION}"
pulumi package gen-sdk --language $* $(SCHEMA_FILE) --version "${VERSION_GENERIC}"

sdk/python: $(SCHEMA_FILE)
rm -rf $@
pulumi package gen-sdk --language python $(SCHEMA_FILE) --version "${VERSION}"
pulumi package gen-sdk --language python $(SCHEMA_FILE) --version "${VERSION_GENERIC}"
cp README.md ${PACKDIR}/python/

dotnet_sdk: sdk/dotnet
cd ${PACKDIR}/dotnet/ && \
echo "${VERSION}" >version.txt && \
echo "${VERSION_GENERIC}" >version.txt && \
dotnet build

go_sdk: sdk/go

nodejs_sdk: sdk/nodejs
cd ${PACKDIR}/nodejs/ && \
yarn install && \
yarn run tsc && \
cp ../../README.md ../../LICENSE package.json yarn.lock bin/
yarn run tsc
cp README.md LICENSE ${PACKDIR}/nodejs/package.json ${PACKDIR}/nodejs/yarn.lock ${PACKDIR}/nodejs/bin/

python_sdk: sdk/python
cp README.md ${PACKDIR}/python/
Expand Down
3 changes: 2 additions & 1 deletion sdk/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"resource": true,
"name": "baremetal",
"server": "github://api.github.com/unmango"
}
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}

0 comments on commit be7edb6

Please sign in to comment.