diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 4b0c517..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Publish Docker image - -on: - workflow_dispatch: - inputs: - mumble-version: - description: "The version (tag or commit hash) of Mumble to build" - required: true - default: "latest" - docker-version: - description: "Docker image version, independent of mumble version" - required: true - default: 0 - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set mumble-version if manual trigger - if: "${{ github.event.inputs.mumble-version != '' }}" - run: echo "MUMBLE_VERSION=${{ github.event.inputs.mumble-version }}" >> $GITHUB_ENV - - - name: Set docker-version if manual trigger - if: "${{ github.event.inputs.docker-version != '' }}" - run: echo "DOCKER_VERSION=${{ github.event.inputs.docker-version }}" >> $GITHUB_ENV - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Build - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/amd64 - push: true - build-args: | - MUMBLE_VERSION=${{ env.MUMBLE_VERSION }} - tags: mumblevoip/mumble-server:latest,mumblevoip/mumble-server:${{ env.MUMBLE_VERSION }},,mumblevoip/mumble-server:${{ env.MUMBLE_VERSION }}-${{ env.DOCKER_VERSION }} diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml new file mode 100644 index 0000000..da77992 --- /dev/null +++ b/.github/workflows/build_and_publish.yml @@ -0,0 +1,49 @@ +name: Build and Publish + +on: + workflow_call: + inputs: + mumble_version: + required: true + type: string + docker_version: + required: true + type: string + platforms: + required: true + type: string + publish: + required: true + type: boolean + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Build + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + if: ${{ inputs.publish }} + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + platforms: ${{ inputs.platforms }} + push: ${{ inputs.publish }} + build-args: | + MUMBLE_VERSION=${{ inputs.mumble_version }} + tags: mumblevoip/mumble-server:latest, mumblevoip/mumble-server:${{ inputs.mumble_version }}, mumblevoip/mumble-server:${{ inputs.mumble_version }}-${{ inputs.docker_version }} + env: + MUMBLE_VERSION: ${{ inputs.mumble_version }} diff --git a/.github/workflows/manual_dispatch.yml b/.github/workflows/manual_dispatch.yml new file mode 100644 index 0000000..567c34d --- /dev/null +++ b/.github/workflows/manual_dispatch.yml @@ -0,0 +1,27 @@ +name: Manual dispatch + +on: + workflow_dispatch: + inputs: + mumble_version: + description: "The version (tag or commit hash) of Mumble to build" + required: true + default: "latest" + docker_version: + description: "Docker image version, independent of mumble version" + required: true + default: "0" + publish: + description: "Whether the built image(s) shall be published to Dockerhub" + required: true + default: "false" + +jobs: + manual_dispatch: + uses: ./.github/workflows/build_and_publish.yml + with: + mumble_version: ${{ github.event.inputs.mumble_version }} + docker_version: ${{ github.event.inputs.docker_version }} + publish: ${{ github.event.inputs.publish == 'true' }} + platforms: "linux/amd64" + secrets: inherit