Skip to content

Commit b292bc9

Browse files
authored
Automating upstream PRs on testing branch
1 parent dde8fda commit b292bc9

1 file changed

Lines changed: 24 additions & 14 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,34 @@ jobs:
2323
- uses: actions/checkout@v4
2424

2525
- name: Determine DNSCrypt version
26+
id: ver
2627
shell: bash
2728
run: |
2829
VERSION="${{ github.event.inputs.dnscrypt_proxy_release }}"
2930
if [ -z "$VERSION" ]; then
3031
VERSION="$(cat DNSCRYPT_PROXY_VERSION)"
3132
fi
32-
echo "DNSCRYPT_PROXY_VERSION=$VERSION" >> "$GITHUB_ENV"
33+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
34+
35+
- name: Compute Docker tags
36+
id: tags
37+
shell: bash
38+
run: |
39+
IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
40+
VERSION="${{ steps.ver.outputs.version }}"
41+
42+
if [ "${{ github.ref_name }}" = "master" ]; then
43+
# Release tags
44+
TAGS="$IMAGE:$VERSION,$IMAGE:latest"
45+
elif [ "${{ github.ref_name }}" = "testing" ]; then
46+
# Testing tags
47+
TAGS="$IMAGE:testing,$IMAGE:testing-$VERSION"
48+
else
49+
# Shouldn't happen due to branch filter, but safe fallback
50+
TAGS="$IMAGE:$VERSION"
51+
fi
52+
53+
echo "tags=$TAGS" >> "$GITHUB_OUTPUT"
3354
3455
- uses: docker/setup-buildx-action@v3
3556

@@ -39,21 +60,10 @@ jobs:
3960
username: ${{ secrets.DOCKERHUB_USERNAME }}
4061
password: ${{ secrets.DOCKERHUB_TOKEN }}
4162

42-
- name: Docker metadata (tags)
43-
id: meta
44-
uses: docker/metadata-action@v5
45-
with:
46-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
47-
tags: |
48-
type=raw,value=${{ env.DNSCRYPT_PROXY_VERSION }},enable=${{ github.ref_name == 'master' }}
49-
type=raw,value=latest,enable=${{ github.ref_name == 'master' }}
50-
type=raw,value=testing,enable=${{ github.ref_name == 'testing' }}
51-
type=raw,value=testing-${{ env.DNSCRYPT_PROXY_VERSION }},enable=${{ github.ref_name == 'testing' }}
52-
5363
- uses: docker/build-push-action@v6
5464
with:
5565
context: .
5666
platforms: linux/amd64
57-
build-args: RELEASE_TAG=${{ env.DNSCRYPT_PROXY_VERSION }}
58-
tags: ${{ steps.meta.outputs.tags }}
67+
build-args: RELEASE_TAG=${{ steps.ver.outputs.version }}
68+
tags: ${{ steps.tags.outputs.tags }}
5969
push: true

0 commit comments

Comments
 (0)