Create Docker image on new release #1308
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Docker image on new release | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 20 * * *' | |
jobs: | |
buildDockerImage: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Get latest stable airdcpp release | |
run: | | |
echo "release_tag=$(curl -fsL https://web-builds.airdcpp.net/stable/ | grep "_64-bit_portable.tar.gz" | grep -v latest | sort -t "_" -k1.14rV | head -n1 | cut -d "_" -f 2)" >> $GITHUB_ENV | |
- | |
name: Does latest stable release exist as docker image | |
run: | | |
echo "num_rels_found=$(curl -fsL 'https://hub.docker.com/v2/repositories/gangefors/airdcpp-webclient/tags/?page_size=10&ordering=last_updated' | jq -r '.results[].name' | grep -c '^${{env.release_tag}}\$')" >> $GITHUB_ENV | |
- | |
name: Get latest develop airdcpp release | |
run: | | |
echo "dev_tag=$(curl -fsL https://web-builds.airdcpp.net/develop/ | grep "_64-bit_portable.tar.gz" | grep -v latest | sort -t "_" -k1.14rV | head -n1 | cut -d "_" -f 2)" >> $GITHUB_ENV | |
- | |
name: Does latest develop release exist as docker image | |
run: | | |
echo "num_dev_rels_found=$(curl -fsL 'https://hub.docker.com/v2/repositories/gangefors/airdcpp-webclient/tags/?page_size=10&ordering=last_updated' | jq -r '.results[].name' | grep -c '^${{env.dev_tag}}\$')" >> $GITHUB_ENV | |
- | |
run: | | |
echo "Stable Version: ${{env.release_tag}} Existing tags: ${{env.num_rels_found}}" | |
echo "Develop Version: ${{env.dev_tag}} Existing tags: ${{env.num_dev_rels_found}}" | |
- | |
if: ${{ env.num_rels_found == 0 || env.num_dev_rels_found == 0 }} | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
if: ${{ env.num_rels_found == 0 || env.num_dev_rels_found == 0 }} | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
if: ${{ env.num_rels_found == 0 || env.num_dev_rels_found == 0 }} | |
name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: gangefors | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
if: ${{ env.num_rels_found == 0 }} | |
name: Build and push stable | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
no-cache: true | |
push: true | |
tags: | | |
gangefors/airdcpp-webclient:latest | |
gangefors/airdcpp-webclient:${{ env.release_tag }} | |
- | |
if: ${{ env.num_dev_rels_found == 0 }} | |
name: Build and push develop | |
id: docker_build_dev | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
no-cache: true | |
push: true | |
tags: | | |
gangefors/airdcpp-webclient:${{ env.dev_tag }} |