Skip to content

Commit

Permalink
Publish ARM64 library as well (#23)
Browse files Browse the repository at this point in the history
Signed-off-by: peterdeme <[email protected]>
  • Loading branch information
peterdeme authored Feb 14, 2023
1 parent 991d80e commit ebc2b28
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Build provider

on: { push: { branches-ignore: [future, main] } }

concurrency:
group: build-provider-${{ github.ref }}
cancel-in-progress: true

jobs:
build-provider:
name: Build provider
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/preprod-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Preprod deployment

on:
push:
branches:
- future

jobs:
preprod-provider-deployment:
Expand Down Expand Up @@ -51,28 +49,38 @@ jobs:
PROVIDER_OS: ${{ matrix.provider_os }}

- name: Create package directory
run: mkdir package && mv bin/pulumi-resource-* package/ && ls -la package/
run: |
mkdir -p package/arm64 package/amd64
mv bin/pulumi-resource-*amd64* package/amd64/pulumi-resource-spacelift
mv bin/pulumi-resource-*arm64* package/arm64/pulumi-resource-spacelift
- name: Create package
run: cd package && tar -zcvf pulumi-resource-spacelift-v0.0.0-${{matrix.provider_os}}-amd64.tar.gz pulumi-resource-*
run: |
cd package/amd64
tar -zcvf pulumi-resource-spacelift-v0.0.0-${{matrix.provider_os}}-amd64.tar.gz pulumi-resource-*
cd ../arm64
tar -zcvf pulumi-resource-spacelift-v0.0.0-${{matrix.provider_os}}-arm64.tar.gz pulumi-resource-*
- name: Create upload directory
run: mkdir -p upload/pulumi-plugins && mv package/*.tar.gz upload/pulumi-plugins/
run: mkdir -p upload/pulumi-plugins && mv package/*/*.tar.gz upload/pulumi-plugins/ && ls -la upload/pulumi-plugins/

- name: Configure AWS credentials
if: github.ref == 'refs/heads/future'
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ secrets.PREPROD_AWS_REGION }}
role-to-assume: ${{ secrets.PREPROD_AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 900

- name: Upload the provider binary to downloads.spacelift.dev
if: github.ref == 'refs/heads/future'
run: >-
aws s3 sync
upload/ s3://${{ secrets.PREPROD_AWS_S3_BUCKET }}/
--no-progress
- name: Invalidate downloads.spacelift.dev cache
if: github.ref == 'refs/heads/future'
run: >-
aws cloudfront create-invalidation
--distribution-id ${{ secrets.PREPROD_DISTRIBUTION }}
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/prod-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Prod deployment

on:
push:
branches:
- main

jobs:
prod-provider-deployment:
name: Build and upload provider
Expand Down Expand Up @@ -50,28 +49,38 @@ jobs:
PROVIDER_OS: ${{ matrix.provider_os }}

- name: Create package directory
run: mkdir package && mv bin/pulumi-resource-* package/ && ls -la package/
run: |
mkdir -p package/arm64 package/amd64
mv bin/pulumi-resource-*amd64* package/amd64/pulumi-resource-spacelift
mv bin/pulumi-resource-*arm64* package/arm64/pulumi-resource-spacelift
- name: Create package
run: cd package && tar -zcvf pulumi-resource-spacelift-v0.0.0-${{matrix.provider_os}}-amd64.tar.gz pulumi-resource-*
run: |
cd package/amd64
tar -zcvf pulumi-resource-spacelift-v0.0.0-${{matrix.provider_os}}-amd64.tar.gz pulumi-resource-*
cd ../arm64
tar -zcvf pulumi-resource-spacelift-v0.0.0-${{matrix.provider_os}}-arm64.tar.gz pulumi-resource-*
- name: Create upload directory
run: mkdir -p upload/pulumi-plugins && mv package/*.tar.gz upload/pulumi-plugins/
run: mkdir -p upload/pulumi-plugins && mv package/*/*.tar.gz upload/pulumi-plugins/ && ls -la upload/pulumi-plugins/

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
if: github.ref == 'refs/heads/main'
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 900

- name: Upload the provider binary to downloads.spacelift.io
if: github.ref == 'refs/heads/main'
run: >-
aws s3 sync
upload/ s3://${{ secrets.AWS_S3_BUCKET }}/
--no-progress
- name: Invalidate downloads.spacelift.io cache
if: github.ref == 'refs/heads/main'
run: >-
aws cloudfront create-invalidation
--distribution-id ${{ secrets.DISTRIBUTION }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ provider/**/schema-embed.json
**/version.txt
**/nuget
**/dist
package/
upload/
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ tfgen:: install_plugins
(cd provider && VERSION=$(VERSION) go generate cmd/${PROVIDER}/main.go)

provider:: tfgen install_plugins # build the provider binary
(cd provider && go build -o $(WORKING_DIR)/bin/${PROVIDER} -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION}" ${PROJECT}/${PROVIDER_PATH}/cmd/${PROVIDER})
(cd provider && \
GOARCH=amd64 go build -o $(WORKING_DIR)/bin/${PROVIDER}-amd64 -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION}" ${PROJECT}/${PROVIDER_PATH}/cmd/${PROVIDER} && \
GOARCH=arm64 go build -o $(WORKING_DIR)/bin/${PROVIDER}-arm64 -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION}" ${PROJECT}/${PROVIDER_PATH}/cmd/${PROVIDER})

build_sdks:: install_plugins provider build_nodejs build_python build_go build_dotnet # build all the sdks

Expand Down

0 comments on commit ebc2b28

Please sign in to comment.