|
1 | | -# This workflow build (but does not push) the OCI image |
2 | | -name: OCI Image - Build |
3 | | - |
| 1 | +# Attempt to build (but not push) the Docker image on Pull Requests |
| 2 | +name: Image build |
4 | 3 | on: |
5 | | - workflow_call: |
6 | | - inputs: |
7 | | - artifact-name: |
8 | | - description: 'The name of the artifact to upload' |
9 | | - required: true |
10 | | - type: string |
11 | | - |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths-ignore: |
| 8 | + - "**.md" |
| 9 | + - "docs/**" |
| 10 | + - "static/**" |
| 11 | + - "LICENSE" |
12 | 12 | permissions: |
13 | 13 | contents: read |
14 | | - |
15 | 14 | jobs: |
16 | 15 | docker-image: |
17 | 16 | name: Check docker image build |
18 | 17 | runs-on: ubuntu-latest |
19 | | - env: |
20 | | - IMAGE_NAME: stacklok/codegate |
21 | | - IMAGE_TAG: dev |
22 | 18 | steps: |
23 | 19 | - name: Checkout |
24 | 20 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
25 | 21 | - name: Set up Docker Buildx |
26 | 22 | uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3 |
27 | | - - name: Download artifact |
28 | | - id: download-artifact |
29 | | - uses: dawidd6/action-download-artifact@80620a5d27ce0ae443b965134db88467fc607b43 # v7 |
30 | | - with: |
31 | | - github_token: ${{ github.token }} |
32 | | - workflow: ".github/workflows/import_packages.yml" |
33 | | - workflow_conclusion: success |
34 | | - name: sqlite_data |
35 | | - name_is_regexp: true |
36 | | - skip_unpack: false |
37 | | - if_no_artifact_found: ignore |
38 | 23 | - name: Fetch latest release URL |
39 | 24 | id: fetch_release_url |
40 | 25 | run: | |
41 | 26 | echo "LATEST_RELEASE=$(curl -s "https://api.github.com/repos/stacklok/codegate-ui/releases/latest" | jq -r '.zipball_url')" >> $GITHUB_ENV |
42 | | - - name: Download git lfs dependencies |
43 | | - run: | |
44 | | - git lfs install |
45 | | - git lfs pull |
46 | 27 | - name: Test build on x86 |
47 | 28 | id: docker_build |
48 | 29 | uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v5 |
|
56 | 37 | cache-to: type=gha,mode=max |
57 | 38 | build-args: | |
58 | 39 | LATEST_RELEASE=${{ env.LATEST_RELEASE }} |
59 | | - tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} |
60 | | - - name: Save Docker image as a tarball |
61 | | - run: | |
62 | | - # List all images |
63 | | - docker images |
64 | | - # Save the image as a tarball |
65 | | - docker save -o image.tar ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} |
66 | | - - name: Upload Docker image artifact |
67 | | - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 |
68 | | - with: |
69 | | - name: ${{ inputs.artifact-name }} |
70 | | - path: image.tar |
0 commit comments