|
| 1 | +on: |
| 2 | + workflow_call: |
| 3 | + inputs: |
| 4 | + relayer_version: |
| 5 | + description: "Relayer version" |
| 6 | + type: string |
| 7 | + default: "0.1.0-alpha.7" |
| 8 | + required: true |
| 9 | + outputs: |
| 10 | + label: |
| 11 | + description: "Label of the self-hosted runner" |
| 12 | + value: ${{ jobs.runner-start.outputs.label }} |
| 13 | + ec2-instance-id: |
| 14 | + description: "ID of the EC2 instance" |
| 15 | + value: ${{ jobs.runner-start.outputs.ec2-instance-id }} |
| 16 | +jobs: |
| 17 | + runner-start: |
| 18 | + name: Start runner |
| 19 | + runs-on: ubuntu-latest |
| 20 | + outputs: |
| 21 | + label: ${{ steps.start.outputs.label }} |
| 22 | + ec2-instance-id: ${{ steps.start.outputs.ec2-instance-id }} |
| 23 | + steps: |
| 24 | + - name: Configure AWS credentials |
| 25 | + uses: aws-actions/configure-aws-credentials@v3 |
| 26 | + with: |
| 27 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 28 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 29 | + aws-region: ${{ secrets.AWS_DEFAULT_REGION }} |
| 30 | + - name: Get aws ami id built by packer |
| 31 | + id: ami-id |
| 32 | + run: | |
| 33 | + ami_id=$(aws ec2 describe-images \ |
| 34 | + --filters "Name=tag:Name,Values=github-runner" "Name=tag:Project,Values=IBC" "Name=tag:ManagedBy,Values=Packer" \ |
| 35 | + --query 'Images[*].[ImageId]' \ |
| 36 | + --output text --max-items 1) |
| 37 | + echo "AMI_ID=$ami_id" >> $GITHUB_OUTPUT |
| 38 | + - uses: actions/checkout@v3 |
| 39 | + - name: Start EC2 instance |
| 40 | + id: start |
| 41 | + uses: machulav/ec2-github-runner@v2 |
| 42 | + with: |
| 43 | + mode: start |
| 44 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + ec2-image-id: ${{ steps.ami-id.outputs.AMI_ID }} |
| 46 | + ec2-instance-type: c5.2xlarge |
| 47 | + subnet-id: subnet-f1fcd4df |
| 48 | + security-group-id: sg-03cb8034e27e1caeb |
| 49 | + aws-resource-tags: > |
| 50 | + [ |
| 51 | + {"Key": "Name", "Value": "ec2-github-runner"}, |
| 52 | + {"Key": "Repository", "Value": "${{ github.repository }}"}, |
| 53 | + {"Key": "Project", "Value": "IBC"} |
| 54 | + ] |
| 55 | + pre-runner-script: | |
| 56 | + ./build.sh ${{ inputs.relayer_version }} |
0 commit comments