From 953e9bc4cc17c6a24a5563e5d589c5640ba99a41 Mon Sep 17 00:00:00 2001 From: cedb Date: Wed, 2 Nov 2022 18:33:00 -0400 Subject: [PATCH] Move to its own file and only trigger on release The reason for this is that the build is that the version is taken from gradle so if we built on any other action it would result in a constant overwrite of the image. --- .github/workflows/ci-docker.yml | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/ci-docker.yml diff --git a/.github/workflows/ci-docker.yml b/.github/workflows/ci-docker.yml new file mode 100644 index 00000000..883a3d38 --- /dev/null +++ b/.github/workflows/ci-docker.yml @@ -0,0 +1,46 @@ +name: signal-cli Docker Image + +on: + release: + types: [published] + +jobs: + + build-docker: + + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: '17' + cache: 'gradle' + + - name: Build with Gradle + run: ./gradlew --no-daemon build + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Get current version from gradle + run: echo "APP_VERSION=$(./gradlew --no-daemon properties -q | grep "version:" | awk '{print $2}')" >> $GITHUB_ENV + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/signal-cli:latest, ${{ secrets.DOCKERHUB_USERNAME }}/signal-cli:${{ env.APP_VERSION }} \ No newline at end of file