Skip to content

Commit

Permalink
[internal] Update GitHub Actions workflow files
Browse files Browse the repository at this point in the history
  • Loading branch information
pulumi-bot committed Jan 8, 2025
1 parent 57ce358 commit aab520e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
- name: Upload Provider Binaries
run: aws s3 cp dist s3://get.pulumi.com/releases/plugins/ --recursive
- name: Create GH Release
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2
if: inputs.isPrerelease == false
with:
tag_name: v${{ inputs.version }}
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ LDFLAGS=$(LDFLAGS_PROJ_VERSION) $(LDFLAGS_UPSTREAM_VERSION) $(LDFLAGS_EXTRAS) $(

# Create a `.make` directory for tracking targets which don't generate a single file output. This should be ignored by git.
# For targets which either don't generate a single file output, or the output file is committed, we use a "sentinel"
# file within `.make/` to track the staleness of the target and only rebuild when needed.
# file within `.make/` to track the staleness of the target and only rebuild when needed.
# For each phony target, we create an internal target with the same name, but prefixed with `.make/` where the work is performed.
# At the end of each internal target we run `@touch $@` to update the file which is the name of the target.

Expand Down Expand Up @@ -264,7 +264,7 @@ bin/$(TFGEN): provider/*.go provider/go.* .make/upstream
# Apply patches to the upstream submodule, if it exists
upstream: .make/upstream
# Re-run if the upstream commit or the patches change
.make/upstream: $(wildcard patches/*) $(wildcard .git/modules/upstream/HEAD)
.make/upstream: $(wildcard patches/*) $(shell ./upstream.sh file_target)
ifneq ("$(wildcard upstream)","")
./upstream.sh init
endif
Expand Down Expand Up @@ -325,22 +325,22 @@ bin/darwin-arm64/$(PROVIDER): TARGET := darwin-arm64
bin/windows-amd64/$(PROVIDER).exe: TARGET := windows-amd64
bin/%/$(PROVIDER) bin/%/$(PROVIDER).exe: bin/jsign-6.0.jar
@# check the TARGET is set
test $(TARGET)
cd provider && \
@test $(TARGET)
@cd provider && \
export GOOS=$$(echo "$(TARGET)" | cut -d "-" -f 1) && \
export GOARCH=$$(echo "$(TARGET)" | cut -d "-" -f 2) && \
export CGO_ENABLED=0 && \
go build -o "${WORKING_DIR}/$@" $(PULUMI_PROVIDER_BUILD_PARALLELISM) -ldflags "$(LDFLAGS)" "$(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)"

@# Only sign windows binary if fully configured.
@# Only sign windows binary if fully configured.
@# Test variables set by joining with | between and looking for || showing at least one variable is empty.
@# Move the binary to a temporary location and sign it there to avoid the target being up-to-date if signing fails.
set -e; \
if [[ "${TARGET}" = "windows-amd64" && ${SKIP_SIGNING} != "true" ]]; then \
@set -e; \
if [[ "${TARGET}" = "windows-amd64" && "${SKIP_SIGNING}" != "true" ]]; then \
if [[ "|${AZURE_SIGNING_CLIENT_ID}|${AZURE_SIGNING_CLIENT_SECRET}|${AZURE_SIGNING_TENANT_ID}|${AZURE_SIGNING_KEY_VAULT_URI}|" == *"||"* ]]; then \
echo "Can't sign windows binaries as required configuration not set: AZURE_SIGNING_CLIENT_ID, AZURE_SIGNING_CLIENT_SECRET, AZURE_SIGNING_TENANT_ID, AZURE_SIGNING_KEY_VAULT_URI"; \
echo "To rebuild with signing delete the unsigned $@ and rebuild with the fixed configuration"; \
if [[ ${CI} == "true" ]]; then exit 1; fi; \
if [[ "${CI}" == "true" ]]; then exit 1; fi; \
else \
mv $@ [email protected]; \
az login --service-principal \
Expand Down
21 changes: 21 additions & 0 deletions upstream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ COMMANDS
check_in Write checkedout commits back to patches, add upstream
and patches changes to the git staging area and exit
checkout mode.
file_target Print a file path to depend on in make.
help Print this help message, plus examples.
OPTIONS
Expand Down Expand Up @@ -334,6 +335,23 @@ re-initializing using updated patches and updated upstream base.
EOF
}

# file_target prints a file path to depend on in make to trigger an init when required.
# Also updates the file timestamp if the submodule needs updating.
file_target() {
path=.git/modules/upstream/HEAD
# Don't print a file if it doesn't exist - it's probably not initialized yet.
if [[ ! -f "${path}" ]]; then
exit 0
fi
# If the submodule is changed, touch the file to trigger a re-init.
desired_commit=$(git ls-tree HEAD upstream | cut -d ' ' -f3 | cut -f1 || true)
current_commit=$(cat "${path}")
if [[ "${desired_commit}" != "${current_commit}" ]]; then
touch "${path}"
fi
echo "${path}"
}

if [[ -z ${original_cmd} ]]; then
echo "Error: command is required."
echo
Expand Down Expand Up @@ -372,6 +390,9 @@ case ${original_cmd} in
check_in|checkin)
check_in "$@"
;;
file_target)
file_target "$@"
;;
*)
echo "Error: unknown command \"${original_cmd}\"."
echo
Expand Down

0 comments on commit aab520e

Please sign in to comment.