-
Notifications
You must be signed in to change notification settings - Fork 13
67 lines (67 loc) · 2.72 KB
/
build-docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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 }}