|
3 | 3 | name: Proto Build Workflow
|
4 | 4 |
|
5 | 5 | on:
|
6 |
| - workflow_dispatch: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - "main" |
| 9 | + tags: |
| 10 | + # semver, e.g. 1.2.0 (does not match 0.1.2) |
| 11 | + - "[1-9]+.[0-9]+.[0-9]+" |
| 12 | + # semver with prerelease info, e.g. 1.0.2-beta.1 or 1.2.3-rc.10 |
| 13 | + - "[1-9]+.[0-9]+.[0-9]+-[a-z]+.[0-9]+" |
| 14 | + # do not match prerelease starting w/ 0, e.g. 1.0.2-beta.0 or 1.2.3-rc.01 |
| 15 | + - "![1-9]+.[0-9]+.[0-9]+-[a-z]+.[0]*" |
| 16 | + # semver with date info, e.g. 1.0.2-20221125 |
| 17 | + - "[1-9]+.[0-9]+.[0-9]+-[0-9]+" |
| 18 | + # do not match date starting w/ 0, e.g. 1.0.2-01232023 |
| 19 | + - "![1-9]+.[0-9]+.[0-9]+-[0]*" |
7 | 20 | pull_request:
|
| 21 | + paths-ignore: |
| 22 | + # do not run if only markdown or other administrative files have been updated |
| 23 | + - "*.md" |
| 24 | + - "CODEOWNERS" |
| 25 | + - "LICENSE" |
8 | 26 | branches:
|
9 | 27 | - "main"
|
10 | 28 |
|
11 | 29 | jobs:
|
12 |
| - dummy: |
| 30 | + build_proto_image: |
| 31 | + name: Build Proto Image |
13 | 32 | runs-on: ubuntu-latest
|
| 33 | + |
14 | 34 | steps:
|
15 |
| - - run: echo "Placeholder workflow" |
| 35 | + - name: Checkout repository |
| 36 | + uses: actions/checkout@v4 |
| 37 | + |
| 38 | + - name: Create image metadata |
| 39 | + id: meta |
| 40 | + uses: ./.github/actions/metadata-action |
| 41 | + with: |
| 42 | + repository: axisecp/acap-runtime |
| 43 | + get_version: "true" |
| 44 | + |
| 45 | + - name: Build Proto image |
| 46 | + uses: ./.github/actions/docker-build-push-action |
| 47 | + with: |
| 48 | + dockerfile: ./Dockerfile.proto |
| 49 | + push: false |
| 50 | + load: true |
| 51 | + tags: axisecp/acap-runtime:${{ steps.meta.outputs.version }}-protofiles |
| 52 | + use_qemu: true |
| 53 | + platform: linux/arm64 |
| 54 | + |
| 55 | + - name: Extract proto files |
| 56 | + run: | |
| 57 | + container_id=$(docker create --platform linux/arm64 axisecp/acap-runtime:${{ steps.meta.outputs.version }}-protofiles) |
| 58 | + docker cp $container_id:/build/param/proto_utils ./proto_utils_param |
| 59 | + docker cp $container_id:/build/vdo/proto_utils ./proto_utils_vdo |
| 60 | + docker cp $container_id:/build/tf/proto_utils ./proto_utils_tf |
| 61 | + docker rm $container_id |
| 62 | +
|
| 63 | + - name: Verify proto files |
| 64 | + run: | |
| 65 | + echo "Verifying proto files..." |
| 66 | +
|
| 67 | + # Check param proto files |
| 68 | + if [ "$(ls -A ./proto_utils_param)" ]; then |
| 69 | + echo "param proto files found:" |
| 70 | + ls -l ./proto_utils_param |
| 71 | + else |
| 72 | + echo "Error: param proto files are missing" |
| 73 | + exit 1 |
| 74 | + fi |
| 75 | +
|
| 76 | + # Check vdo proto files |
| 77 | + if [ "$(ls -A ./proto_utils_vdo)" ]; then |
| 78 | + echo "vdo proto files found:" |
| 79 | + ls -l ./proto_utils_vdo |
| 80 | + else |
| 81 | + echo "Error: vdo proto files are missing" |
| 82 | + exit 1 |
| 83 | + fi |
| 84 | +
|
| 85 | + # Check tf proto files |
| 86 | + if [ "$(ls -A ./proto_utils_tf)" ]; then |
| 87 | + echo "tf proto files found:" |
| 88 | + ls -l ./proto_utils_tf |
| 89 | + else |
| 90 | + echo "Error: tf proto files are missing" |
| 91 | + exit 1 |
| 92 | + fi |
| 93 | +
|
| 94 | + echo "All proto files verified successfully" |
| 95 | +
|
| 96 | + - name: Push Proto image |
| 97 | + if: success() |
| 98 | + uses: ./.github/actions/docker-build-push-action |
| 99 | + with: |
| 100 | + dockerfile: ./Dockerfile.proto |
| 101 | + push: true |
| 102 | + platform: linux/arm64 |
| 103 | + use_qemu: true |
| 104 | + tags: axisecp/acap-runtime:${{ steps.meta.outputs.version }}-protofiles |
| 105 | + registry_user: ${{ secrets.ECOSYSTEM_SERVICE_USER_DOCKER_HUB }} |
| 106 | + registry_token: ${{ secrets.ECOSYSTEM_ACCESS_TOKEN_DOCKER_HUB }} |
0 commit comments