Skip to content

Commit c7c6a96

Browse files
committed
Add build branch workflow
1 parent 955c739 commit c7c6a96

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/build_branch.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build branch for docker
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
description: "Branch to build"
8+
required: true
9+
10+
env:
11+
AWS_REGION: us-west-1
12+
AWS_ROLE: ${{ vars.EC2_GITHUB_RUNNER_ROLE }}
13+
REGISTRY_IMAGE: oxen/oxen-server
14+
15+
permissions:
16+
id-token: write
17+
contents: write
18+
19+
jobs:
20+
start-self-hosted-runner:
21+
name: Start self-hosted EC2 runner
22+
runs-on: ubuntu-latest
23+
outputs:
24+
label: ${{ steps.start-ec2-runner.outputs.label }}
25+
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
26+
27+
steps:
28+
- name: Configure AWS credentials
29+
uses: aws-actions/configure-aws-credentials@v4
30+
with:
31+
role-to-assume: ${{ env.AWS_ROLE }}
32+
role-duration-seconds: 900
33+
aws-region: ${{ env.AWS_REGION }}
34+
35+
- name: Start EC2 runner
36+
id: start-ec2-runner
37+
uses: machulav/ec2-github-runner@v2
38+
with:
39+
mode: start
40+
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
41+
ec2-image-id: ${{ vars.EC2_IMAGE_ID }}
42+
ec2-instance-type: m7g.4xlarge
43+
subnet-id: ${{ vars.SUBNET_ID }}
44+
security-group-id: ${{ vars.SECURITY_GROUP_ID }}
45+
aws-resource-tags: >
46+
[
47+
{"Key": "Name", "Value": "ec2-github-runner"}
48+
]
49+
50+
release_docker_arm64:
51+
needs: start-self-hosted-runner
52+
runs-on: ${{ needs.start-self-hosted-runner.outputs.label }}
53+
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v4
57+
with:
58+
ref: ${{ github.event.inputs.branch }}
59+
60+
- name: Set release version
61+
run: |
62+
echo "RELEASE_VERSION=nighly-$(date +'%Y-%m-%d-%H_%M_%S')" >> $GITHUB_ENV
63+
64+
- name: Build Docker Image
65+
run: docker build -t oxen/oxen-server .
66+
67+
- name: Save Docker
68+
run: docker save oxen/oxen-server -o oxen-server-docker-arm64-${{ env.RELEASE_VERSION }}.tar
69+
70+
- name: Upload Artifact
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: oxen-server-docker-arm64-${{ env.RELEASE_VERSION }}.tar
74+
path: oxen-server-docker-arm64-${{ env.RELEASE_VERSION }}.tar
75+
retention-days: 1

0 commit comments

Comments
 (0)