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