|
| 1 | +name: "Build dev container" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - develop |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +env: |
| 14 | + REGISTRY: ghcr.io |
| 15 | + IMAGE_NAME: ${{ github.repository }} |
| 16 | + |
| 17 | +jobs: |
| 18 | + list-dir: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + outputs: |
| 21 | + dir: ${{ steps.list-dir.outputs.dir }} |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: List Dir |
| 27 | + id: list-dir |
| 28 | + uses: pnstack/actions/list-dir@main |
| 29 | + with: |
| 30 | + dir: templates-arm |
| 31 | + |
| 32 | + - name: log |
| 33 | + run: echo ${{ steps.list-dir.outputs.dir }} |
| 34 | + |
| 35 | + build: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + needs: [list-dir] |
| 38 | + strategy: |
| 39 | + fail-fast: false |
| 40 | + matrix: |
| 41 | + dir: ${{fromJson(needs.list-dir.outputs.dir)}} |
| 42 | + steps: |
| 43 | + - name: Checkout |
| 44 | + uses: actions/checkout@v4 |
| 45 | + |
| 46 | + - name: Set up QEMU |
| 47 | + uses: docker/setup-qemu-action@v3 |
| 48 | + |
| 49 | + - name: Set up Docker Buildx |
| 50 | + uses: docker/setup-buildx-action@v3 |
| 51 | + with: |
| 52 | + use: true |
| 53 | + |
| 54 | + - name: Log in to the Container registry |
| 55 | + |
| 56 | + with: |
| 57 | + registry: ${{ env.REGISTRY }} |
| 58 | + username: ${{ github.actor }} |
| 59 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 60 | + |
| 61 | + - name: Extract metadata (tags, labels) for Docker |
| 62 | + id: meta |
| 63 | + uses: docker/metadata-action@v5 |
| 64 | + with: |
| 65 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 66 | + |
| 67 | + - name: Build and run Dev Container task |
| 68 | + uses: devcontainers/[email protected] |
| 69 | + with: |
| 70 | + subFolder: ./templates-arm/${{ matrix.dir }} |
| 71 | + imageName: ghcr.io/pnstack/codespace/${{ matrix.dir }}-arm |
| 72 | + cacheFrom: ghcr.io/pnstack/codespace/${{ matrix.dir }}:latest |
| 73 | + imageTag: ${{ github.ref == 'refs/heads/main' && 'latest' || steps.meta.outputs.tags }} |
| 74 | + platform: linux/arm64 |
| 75 | + push: always |
0 commit comments