diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..0c1eeea7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +--- +name: Build USB Sidecar + +on: # yamllint disable-line rule:truthy + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build-container: + runs-on: "ubuntu-latest" + permissions: + contents: "read" + packages: "write" + + steps: + - uses: earthly/actions-setup@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + version: "0.7.1" + - uses: "actions/checkout@v3" + + - name: "Login to GitHub Container Hub" + if: github.event_name != 'pull_request' + run: docker login --username "${{ secrets.actor }}" --password "${{ secrets.GITHUB_TOKEN }}" --registry ghcr.io + + - name: "Build USB Container Image" + run: earthly +usb-image + env: + EARTHLY_CI: true + EARTHLY_PUSH: ${{ github.event_name != 'pull_request' }} + # Only one platform per https://docs.earthly.dev/docs/earthly-command#build-options + EARTHLY_PLATFORMS: linux/amd64 diff --git a/Earthfile b/Earthfile index d8c7667c..7e19b3dc 100644 --- a/Earthfile +++ b/Earthfile @@ -25,3 +25,15 @@ prettier-lint: lint: BUILD +prettier-lint + +usb-image: + FROM alpine + + RUN mkdir -p /usr/lib/extension-release.d/ + RUN echo ID=_any > /usr/lib/extension-release.d/extension-release.kubo + SAVE ARTIFACT /usr/lib/extension-release.d + SAVE ARTIFACT /usr/bin/lsusb + SAVE ARTIFACT /usr/bin/less + +images: + BUILD +usb-image