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.
This commit is contained in:
cedb 2022-11-02 18:33:00 -04:00
parent bb6ab5e580
commit 953e9bc4cc

46
.github/workflows/ci-docker.yml vendored Normal file
View file

@ -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 }}