xref: /DragonOS/.github/workflows/publish-dragonos-docker-image.yml (revision 415e46ea470ba1dd33e4368c3684c700a75f3be8)
1*415e46eaSLoGinname: Publish Docker images
2*415e46eaSLoGin
3*415e46eaSLoGinon:
4*415e46eaSLoGin  workflow_dispatch:
5*415e46eaSLoGin  push:
6*415e46eaSLoGin    paths:
7*415e46eaSLoGin      - tools/BUILD_CONTAINER_VERSION
8*415e46eaSLoGin
9*415e46eaSLoGinjobs:
10*415e46eaSLoGin  docker:
11*415e46eaSLoGin    runs-on: ubuntu-latest
12*415e46eaSLoGin    steps:
13*415e46eaSLoGin      - name: Set up Docker Buildx
14*415e46eaSLoGin        uses: docker/setup-buildx-action@v2
15*415e46eaSLoGin
16*415e46eaSLoGin      - name: Login to Docker Hub
17*415e46eaSLoGin        uses: docker/login-action@v2
18*415e46eaSLoGin        with:
19*415e46eaSLoGin          username: ${{ secrets.DOCKERHUB_USERNAME }}
20*415e46eaSLoGin          password: ${{ secrets.DOCKERHUB_TOKEN }}
21*415e46eaSLoGin
22*415e46eaSLoGin      - uses: actions/checkout@v4
23*415e46eaSLoGin
24*415e46eaSLoGin      - name: Fetch versions in the repo
25*415e46eaSLoGin        id: fetch-versions
26*415e46eaSLoGin        run: |
27*415e46eaSLoGin          BUILD_CONTAINER_VERSION=$(cat tools/BUILD_CONTAINER_VERSION)
28*415e46eaSLoGin          echo "build_container_version=$BUILD_CONTAINER_VERSION" >> "$GITHUB_OUTPUT"
29*415e46eaSLoGin
30*415e46eaSLoGin      - name: Build and push docker image
31*415e46eaSLoGin        uses: docker/build-push-action@v4
32*415e46eaSLoGin        with:
33*415e46eaSLoGin          context: .
34*415e46eaSLoGin          file: ./tools/Dockerfile
35*415e46eaSLoGin          platforms: linux/amd64
36*415e46eaSLoGin          push: true
37*415e46eaSLoGin          tags: dragonos/dragonos-dev:${{ steps.fetch-versions.outputs.build_container_version }}
38