1- name : Build release binaries
1+ name : Build release artifacts
22on :
33 release :
44 types : [published]
@@ -13,81 +13,20 @@ permissions:
1313 packages : write
1414
1515jobs :
16- start-runner :
17- name : Start EC2 runner
18- runs-on : ubuntu-latest
19- outputs :
20- instance_id : ${{ steps.invoke-start.outputs.INSTANCE_ID }}
21- steps :
22- - uses : aws-actions/configure-aws-credentials@v4
23- with :
24- role-to-assume : ${{ secrets.EC2_ROLE }}
25- aws-region : ${{ vars.EC2_REGION }}
26- - name : Start EC2 instance
27- id : invoke-start
28- env :
29- GH_TOKEN : ${{ secrets.GH_TOKEN_FOR_UPDATES }}
30- EC2_START : ${{ secrets.EC2_START }}
31- run : |
32- RUNNER_TOKEN=$(gh api -X POST -q '.token' /repos/${{ github.repository }}/actions/runners/registration-token)
33- aws lambda invoke \
34- --cli-binary-format raw-in-base64-out \
35- --function-name "$EC2_START" \
36- --payload '{"ref_name":"${{ github.ref_name }}","runner_token":"'"${RUNNER_TOKEN}"'"}' \
37- response.json
38- INSTANCE_ID=$(jq -r '.body.instance_id' < response.json)
39- echo "INSTANCE_ID=${INSTANCE_ID}" >>"$GITHUB_OUTPUT"
40- echo "Got EC2 instance ${INSTANCE_ID}"
41- echo 'Waiting for GitHub runner to start'
42- while [[ -z "$(gh api /repos/${{ github.repository }}/actions/runners | jq '.runners[] | select(.name == "ec2-spot")')" ]]; do
43- sleep 60
44- done
45- echo 'Done 🎉'
46-
47- stop-runner :
48- name : Stop EC2 runner
49- runs-on : ubuntu-latest
50- # Ensure that `stop-runner` will always stop the EC2 instance, even if other jobs failed or were canceled
51- if : ${{ always() }}
52- needs :
53- - start-runner
54- - docker-multiplatform-image
55- steps :
56- - uses : aws-actions/configure-aws-credentials@v4
57- with :
58- role-to-assume : ${{ secrets.EC2_ROLE }}
59- aws-region : ${{ vars.EC2_REGION }}
60- - name : Delete GitHub Runner
61- env :
62- GH_TOKEN : ${{ secrets.GH_TOKEN_FOR_UPDATES }}
63- run : |
64- RUNNER_ID=$(gh api /repos/${{ github.repository }}/actions/runners | jq '.runners[] | select(.name == "ec2-spot") | .id')
65- if [[ -n "${RUNNER_ID}" ]]; then
66- gh api -X DELETE /repos/${{ github.repository }}/actions/runners/${RUNNER_ID}
67- fi
68- - name : Lambda Invoke Stop
69- env :
70- EC2_STOP : ${{ secrets.EC2_STOP }}
71- run : |
72- aws lambda invoke \
73- --cli-binary-format raw-in-base64-out \
74- --function-name "$EC2_STOP" \
75- --payload '{"instance_id":"${{ needs.start-runner.outputs.instance_id }}"}' \
76- response.json
77- cat response.json
78-
7916 release-artifacts :
8017 name : " Build Nickel binary and Docker image"
8118 strategy :
8219 matrix :
8320 os :
8421 - runs-on : ubuntu-latest
8522 architecture : x86_64
86- - runs-on : [EC2, ARM64, Linux]
23+ # We don't use the latest version of Ubuntu on the ARM runner because
24+ # rustc is likely to crash, see
25+ # https://github.com/rust-lang/rust/issues/135867. Do not update until
26+ # #135867 is fixed.
27+ - runs-on : ubuntu-22.04-arm
8728 architecture : arm64
8829 runs-on : ${{ matrix.os.runs-on }}
89- needs :
90- - start-runner
9130 steps :
9231 - uses : actions/checkout@v4
9332 with :
14988 RELEASE_TAG : ${{ github.event_name == 'release' && github.event.release.tag_name || github.event.inputs.release_tag }}
15089 run : |
15190 docker buildx imagetools create -t ghcr.io/tweag/nickel:$RELEASE_TAG ghcr.io/tweag/nickel:$RELEASE_TAG-x86_64 ghcr.io/tweag/nickel:$RELEASE_TAG-arm64
152- docker buildx imagetools inspect ghcr.io/tweag/nickel:$RELEASE_TAG
91+ docker buildx imagetools inspect ghcr.io/tweag/nickel:$RELEASE_TAG
15392
15493 release-artifacts-macos :
15594 name : " Build MacOS Nickel binaries"
0 commit comments