|
| 1 | +name: Dev Container |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '24 8 * * *' |
| 6 | + push: |
| 7 | + branches: [ main ] |
| 8 | + # Publish semver tags as releases. |
| 9 | + tags: [ 'v*.*.*' ] |
| 10 | + pull_request: |
| 11 | + branches: [ main ] |
| 12 | + |
| 13 | +env: |
| 14 | + # Use docker.io for Docker Hub if empty |
| 15 | + REGISTRY: ghcr.io |
| 16 | + # github.repository as <account>/<repo> |
| 17 | + IMAGE_NAME: ${{ github.actor }}/zephyr |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + permissions: |
| 23 | + contents: read |
| 24 | + packages: write |
| 25 | + id-token: write |
| 26 | + |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + arch: [x86_64] |
| 30 | + sdk: [0.15.2] |
| 31 | + zephyr: [main,v3.2.0] |
| 32 | + tool: [ |
| 33 | + { prefix: "arm", suffix: "-zephyr-eabi"}, |
| 34 | + { prefix: "x86_64", suffix: "-zephyr-elf"}, |
| 35 | + ] |
| 36 | + |
| 37 | + steps: |
| 38 | + - name: Checkout repository |
| 39 | + uses: actions/checkout@v3 |
| 40 | + |
| 41 | + # https://github.com/marketplace/actions/docker-setup-buildx |
| 42 | + - name: Setup Docker buildx |
| 43 | + uses: docker/setup-buildx-action@v2 |
| 44 | + |
| 45 | + # Login against a Docker registry except on PR |
| 46 | + # https://github.com/docker/login-action |
| 47 | + - name: Log into registry ${{ env.REGISTRY }} |
| 48 | + if: github.event_name != 'pull_request' |
| 49 | + uses: docker/login-action@v2 |
| 50 | + with: |
| 51 | + registry: ${{ env.REGISTRY }} |
| 52 | + username: ${{ github.actor }} |
| 53 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + |
| 55 | + # Extract metadata (tags, labels) for Docker |
| 56 | + # https://github.com/docker/metadata-action |
| 57 | + - name: Extract Docker metadata |
| 58 | + id: meta |
| 59 | + uses: docker/metadata-action@v4 |
| 60 | + with: |
| 61 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 62 | + |
| 63 | + # Build and push Docker image with Buildx (don't push on PR) |
| 64 | + # https://github.com/docker/build-push-action |
| 65 | + - name: Build and push Docker image |
| 66 | + id: build-and-push |
| 67 | + uses: docker/build-push-action@v3 |
| 68 | + with: |
| 69 | + context: . |
| 70 | + push: ${{ github.event_name != 'pull_request' }} |
| 71 | + tags: ghcr.io/${{ github.actor }}/gsoc-2022-arduino-core |
| 72 | + labels: ${{ steps.meta.outputs.labels }} |
| 73 | + build-args: | |
| 74 | + ARCHITECTURE=${{ matrix.arch }} |
| 75 | + ZEPHYR_SDK_VERSION=${{ matrix.sdk }} |
| 76 | + ZEPHYR_VERSION=${{ matrix.zephyr }} |
| 77 | + TOOLCHAIN=${{ matrix.tool.prefix }}${{ matrix.tool.suffix }} |
0 commit comments