diff --git a/.github/workflows/ci.yml b/.github/workflows/ci-baremetal.yml similarity index 96% rename from .github/workflows/ci.yml rename to .github/workflows/ci-baremetal.yml index e259f6ab4fcbb0dd925604d3da5ad3e1e79274d3..1a10496a396996e42890acff957ec44ee915d489 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci-baremetal.yml @@ -1,13 +1,13 @@ -name: ci +name: Multi Arch Bare Metal CI on: workflow_dispatch: - push: - branches: - - 'releases/v*' - - 'develop' - tags: - - 'v*.*.*' +# push: +# branches: +# - 'releases/v*' +# - 'develop' +# tags: +# - 'v*.*.*' concurrency: group: ${{ github.ref }} diff --git a/.github/workflows/ci-qemu.yml b/.github/workflows/ci-qemu.yml new file mode 100644 index 0000000000000000000000000000000000000000..354ea21d3bf672da758f3584c1ac813b618ddf81 --- /dev/null +++ b/.github/workflows/ci-qemu.yml @@ -0,0 +1,91 @@ +name: Multi Arch Bare Metal CI + +on: + workflow_dispatch: + push: + branches: + - 'releases/v*' + - 'develop' + tags: + - 'v*.*.*' + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + docker: + runs-on: [self-hosted, qemu] + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set the environment variable + run: echo REPOSITORY_NAME=${GITHUB_REPOSITORY#*\/} >> $GITHUB_ENV + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + "${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPOSITORY_NAME }}" + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + labels: | + org.opencontainers.image.description=A test for Docker CI with Github Actions. + + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to Private registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ${{ secrets.PRIVATEHUB_HOSTNAME }} + username: ${{ secrets.PRIVATEHUB_USERNAME }} + password: ${{ secrets.PRIVATEHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + config-inline: | + [registry."docker.io"] + mirrors = ["${{ secrets.DOCKERHUB_PROXY_HOSTNAME }}"] + [registry."${{ secrets.PRIVATEHUB_HOSTNAME }}"] + http = true + insecure = true + driver-opts: | + network=host + buildkitd-flags: | + --debug + --allow-insecure-entitlement network.host + --allow-insecure-entitlement security.insecure + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + platforms: linux/amd64,linux/arm64/v8 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=${{ secrets.PRIVATEHUB_HOSTNAME }}/${{ env.REPOSITORY_NAME }}:buildcache + cache-to: type=registry,ref=${{ secrets.PRIVATEHUB_HOSTNAME }}/${{ env.REPOSITORY_NAME }}:buildcache,mode=min,compression=zstd + + - name: Update repo description + uses: peter-evans/dockerhub-description@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + repository: "${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPOSITORY_NAME }}"