@@ -806,18 +806,60 @@ jobs:
806
806
807
807
echo "Required checks have passed"
808
808
809
+ # Builds the dylibs and upload it as an artifact so it can be embedded in the main build
810
+ build-dylib :
811
+ needs : changes
812
+ if : github.ref == 'refs/heads/main' && needs.changes.outputs.docs-only == 'false' && !github.event.pull_request.head.repo.fork
813
+ runs-on : ${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest' }}
814
+ steps :
815
+ - name : Harden Runner
816
+ uses : step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
817
+ with :
818
+ egress-policy : audit
819
+
820
+ - name : Checkout
821
+ uses : actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
822
+ with :
823
+ fetch-depth : 0
824
+
825
+ - name : Setup Node
826
+ uses : ./.github/actions/setup-node
827
+
828
+ - name : Setup Go
829
+ uses : ./.github/actions/setup-go
830
+
831
+ - name : Build dylibs
832
+ run : |
833
+ set -euxo pipefail
834
+ go mod download
835
+
836
+ make gen/mark-fresh
837
+ make build/coder-dylib
838
+
839
+ - name : Upload build artifacts
840
+ uses : actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
841
+ with :
842
+ name : dylibs
843
+ path : |
844
+ ./build/*.h
845
+ ./build/*.dylib
846
+ retention-days : 7
847
+
809
848
build :
810
849
# This builds and publishes ghcr.io/coder/coder-preview:main for each commit
811
850
# to main branch.
812
- needs : changes
813
- if : github.ref == 'refs/heads/main' && needs.changes.outputs.docs-only == 'false' && !github.event.pull_request.head.repo.fork
851
+ needs :
852
+ - changes
853
+ - build-dylib
854
+ # TODO: Uncomment
855
+ # if: github.ref == 'refs/heads/main' && needs.changes.outputs.docs-only == 'false' && !github.event.pull_request.head.repo.fork
814
856
runs-on : ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
815
- permissions :
816
- packages : write # Needed to push images to ghcr.io
817
- env :
818
- DOCKER_CLI_EXPERIMENTAL : " enabled"
819
- outputs :
820
- IMAGE : ghcr.io/coder/coder-preview:${{ steps.build-docker.outputs.tag }}
857
+ # permissions:
858
+ # packages: write # Needed to push images to ghcr.io
859
+ # env:
860
+ # DOCKER_CLI_EXPERIMENTAL: "enabled"
861
+ # outputs:
862
+ # IMAGE: ghcr.io/coder/coder-preview:${{ steps.build-docker.outputs.tag }}
821
863
steps :
822
864
- name : Harden Runner
823
865
uses : step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
@@ -848,6 +890,16 @@ jobs:
848
890
- name : Install zstd
849
891
run : sudo apt-get install -y zstd
850
892
893
+ - name : Download dylibs
894
+ uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
895
+ with :
896
+ name : dylibs
897
+ path : ./build
898
+ - run : |
899
+ mv ./build/*amd64.dylib ./site/out/bin/coder-amd64.dylib
900
+ mv ./build/*arm64.dylib ./site/out/bin/coder-arm64.dylib
901
+ mv ./build/*.h ./site/out/bin/coder-dylib.h
902
+
851
903
- name : Build
852
904
run : |
853
905
set -euxo pipefail
@@ -863,60 +915,61 @@ jobs:
863
915
build/coder_"$version"_windows_amd64.zip \
864
916
build/coder_"$version"_linux_amd64.{tar.gz,deb}
865
917
866
- - name : Build Linux Docker images
867
- id : build-docker
868
- env :
869
- CODER_IMAGE_BASE : ghcr.io/coder/coder-preview
870
- CODER_IMAGE_TAG_PREFIX : main
871
- DOCKER_CLI_EXPERIMENTAL : " enabled"
872
- run : |
873
- set -euxo pipefail
874
-
875
- # build Docker images for each architecture
876
- version="$(./scripts/version.sh)"
877
- tag="main-$(echo "$version" | sed 's/+/-/g')"
878
- echo "tag=$tag" >> $GITHUB_OUTPUT
879
-
880
- # build images for each architecture
881
- # note: omitting the -j argument to avoid race conditions when pushing
882
- make build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
883
-
884
- # only push if we are on main branch
885
- if [ "${{ github.ref }}" == "refs/heads/main" ]; then
886
- # build and push multi-arch manifest, this depends on the other images
887
- # being pushed so will automatically push them
888
- # note: omitting the -j argument to avoid race conditions when pushing
889
- make push/build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
890
-
891
- # Define specific tags
892
- tags=("$tag" "main" "latest")
893
-
894
- # Create and push a multi-arch manifest for each tag
895
- # we are adding `latest` tag and keeping `main` for backward
896
- # compatibality
897
- for t in "${tags[@]}"; do
898
- ./scripts/build_docker_multiarch.sh \
899
- --push \
900
- --target "ghcr.io/coder/coder-preview:$t" \
901
- --version $version \
902
- $(cat build/coder_"$version"_linux_{amd64,arm64,armv7}.tag)
903
- done
904
- fi
905
-
906
- - name : Prune old images
907
- if : github.ref == 'refs/heads/main'
908
- uses : vlaurin/action-ghcr-prune@0cf7d39f88546edd31965acba78cdcb0be14d641 # v0.6.0
909
- with :
910
- token : ${{ secrets.GITHUB_TOKEN }}
911
- organization : coder
912
- container : coder-preview
913
- keep-younger-than : 7 # days
914
- keep-tags : latest
915
- keep-tags-regexes : ^pr
916
- prune-tags-regexes : |
917
- ^main-
918
- ^v
919
- prune-untagged : true
918
+ # TODO: Uncomment
919
+ # - name: Build Linux Docker images
920
+ # id: build-docker
921
+ # env:
922
+ # CODER_IMAGE_BASE: ghcr.io/coder/coder-preview
923
+ # CODER_IMAGE_TAG_PREFIX: main
924
+ # DOCKER_CLI_EXPERIMENTAL: "enabled"
925
+ # run: |
926
+ # set -euxo pipefail
927
+
928
+ # # build Docker images for each architecture
929
+ # version="$(./scripts/version.sh)"
930
+ # tag="main-$(echo "$version" | sed 's/+/-/g')"
931
+ # echo "tag=$tag" >> $GITHUB_OUTPUT
932
+
933
+ # # build images for each architecture
934
+ # # note: omitting the -j argument to avoid race conditions when pushing
935
+ # make build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
936
+
937
+ # # only push if we are on main branch
938
+ # if [ "${{ github.ref }}" == "refs/heads/main" ]; then
939
+ # # build and push multi-arch manifest, this depends on the other images
940
+ # # being pushed so will automatically push them
941
+ # # note: omitting the -j argument to avoid race conditions when pushing
942
+ # make push/build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
943
+
944
+ # # Define specific tags
945
+ # tags=("$tag" "main" "latest")
946
+
947
+ # # Create and push a multi-arch manifest for each tag
948
+ # # we are adding `latest` tag and keeping `main` for backward
949
+ # # compatibality
950
+ # for t in "${tags[@]}"; do
951
+ # ./scripts/build_docker_multiarch.sh \
952
+ # --push \
953
+ # --target "ghcr.io/coder/coder-preview:$t" \
954
+ # --version $version \
955
+ # $(cat build/coder_"$version"_linux_{amd64,arm64,armv7}.tag)
956
+ # done
957
+ # fi
958
+
959
+ # - name: Prune old images
960
+ # if: github.ref == 'refs/heads/main'
961
+ # uses: vlaurin/action-ghcr-prune@0cf7d39f88546edd31965acba78cdcb0be14d641 # v0.6.0
962
+ # with:
963
+ # token: ${{ secrets.GITHUB_TOKEN }}
964
+ # organization: coder
965
+ # container: coder-preview
966
+ # keep-younger-than: 7 # days
967
+ # keep-tags: latest
968
+ # keep-tags-regexes: ^pr
969
+ # prune-tags-regexes: |
970
+ # ^main-
971
+ # ^v
972
+ # prune-untagged: true
920
973
921
974
- name : Upload build artifacts
922
975
if : github.ref == 'refs/heads/main'
0 commit comments