Avoiding version collision with different branches #68
This file contains hidden or 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: Build | |
| on: | |
| push: | |
| branches: [ master, testing ] | |
| workflow_dispatch: | |
| inputs: | |
| dnscrypt_proxy_release: | |
| description: "DNSCrypt Proxy Release (blank = latest upstream)" | |
| required: false | |
| env: | |
| REGISTRY: docker.io | |
| IMAGE_NAME: xtr0py/dnscrypt-proxy-2-docker | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Determine DNSCrypt version | |
| shell: bash | |
| run: | | |
| VERSION="${{ github.event.inputs.dnscrypt_proxy_release }}" | |
| if [ -z "$VERSION" ]; then | |
| VERSION="$(curl -fsSL https://api.github.com/repos/DNSCrypt/dnscrypt-proxy/releases/latest \ | |
| | python -c "import sys,json; print(json.load(sys.stdin)['tag_name'].lstrip('v'))")" | |
| fi | |
| echo "DNSCRYPT_PROXY_VERSION=$VERSION" >> "$GITHUB_ENV" | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Docker metadata (tags) | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=${{ env.DNSCRYPT_PROXY_VERSION }},enable=${{ github.ref_name == 'master' }} | |
| type=raw,value=latest,enable=${{ github.ref_name == 'master' }} | |
| type=raw,value=testing,enable=${{ github.ref_name == 'testing' }} | |
| type=raw,value=testing-${{ env.DNSCRYPT_PROXY_VERSION }},enable=${{ github.ref_name == 'testing' }} | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64 | |
| build-args: RELEASE_TAG=${{ env.DNSCRYPT_PROXY_VERSION }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| push: true |