diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7c7df06 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: Continuous Integration + +on: + pull_request: null + push: + branches: + - main + workflow_dispatch: null + +env: + DOCKER_REGISTRY: ghcr.io + DOCKER_IMAGE_BASE: jstz-dev + +jobs: + build-docker: + name: Build and push Docker images + strategy: + matrix: + include: + - image: x86_64 + - image: riscv64 + - image: aarch64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: 'true' + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 + with: + registry: '${{ env.DOCKER_REGISTRY }}' + username: '${{ github.actor }}' + password: '${{ secrets.GITHUB_TOKEN }}' + - name: Extract metadata + id: meta + uses: docker/metadata-action@v3 + with: + images: >- + ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}/hermit-toolchain-${{ matrix.image }} + tags: | + type=ref,event=tag + {{date 'YYYYMMDD'}} + - uses: docker/build-push-action@v6.3.0 + with: + context: . + push: true + build-args: | + TARGET=${{ matrix.image }}-hermit + cache-from: type=gha + cache-to: 'type=gha,mode=max' + tags: '${{ steps.meta.outputs.tags }}' + labels: '${{ steps.meta.outputs.labels }}' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 934bab0..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Publish - -on: - pull_request: - push: - branches: - - master - workflow_dispatch: - -jobs: - docker: - name: Build and push Docker image - runs-on: ubuntu-latest - steps: - - uses: docker/setup-buildx-action@v3 - - uses: docker/login-action@v3 - if: github.event_name != 'pull_request' - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/build-push-action@v5 - with: - push: ${{ github.event_name != 'pull_request' }} - tags: ghcr.io/hermit-os/hermit-toolchain:latest