Prepare v0.1.85 release #394
Workflow file for this run
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: Docker | |
| on: | |
| push: | |
| tags: ['v*'] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Release tag to (re)publish, for example v0.1.79" | |
| required: true | |
| jobs: | |
| build: | |
| runs-on: [self-hosted, Linux, X64, iptvtunerr] | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| HAS_DOCKERHUB: ${{ secrets.DOCKERHUB_TOKEN != '' && 'true' || 'false' }} | |
| RELEASE_TAG: ${{ github.event.inputs.tag || github.ref_name }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.inputs.tag || github.ref }} | |
| fetch-depth: 0 | |
| - name: Require release tag on main | |
| env: | |
| RELEASE_TAG_MAIN_MODE: ancestor | |
| run: ./scripts/ensure-release-tag-on-main.sh "${RELEASE_TAG}" | |
| - uses: docker/setup-qemu-action@v4 | |
| - name: Write BuildKit network config | |
| id: buildkit-config | |
| run: | | |
| set -euo pipefail | |
| config="${RUNNER_TEMP:-/tmp}/iptvtunerr-buildkitd.toml" | |
| mapfile -t nameservers < <(awk '$1 == "nameserver" { print $2 }' /etc/resolv.conf) | |
| if [[ "${#nameservers[@]}" -eq 0 ]]; then | |
| nameservers=(1.1.1.1 9.9.9.9) | |
| fi | |
| quoted="" | |
| for ns in "${nameservers[@]}"; do | |
| if [[ -n "$quoted" ]]; then | |
| quoted+=", " | |
| fi | |
| quoted+="\"$ns\"" | |
| done | |
| cat > "$config" <<EOF | |
| [dns] | |
| nameservers = [$quoted] | |
| [registry."docker.io"] | |
| mirrors = ["mirror.gcr.io"] | |
| EOF | |
| echo "path=$config" >> "$GITHUB_OUTPUT" | |
| - uses: docker/setup-buildx-action@v4 | |
| with: | |
| buildkitd-config: ${{ steps.buildkit-config.outputs.path }} | |
| - uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GHCR_TOKEN || secrets.GITHUB_TOKEN }} | |
| - name: Login to Docker Hub | |
| id: dockerhub | |
| if: env.HAS_DOCKERHUB == 'true' | |
| continue-on-error: true | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME || 'snapetech' }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Docker metadata (tags/labels) | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: | | |
| ghcr.io/${{ github.repository }} | |
| ${{ steps.dockerhub.outcome == 'success' && 'snapetech/iptvtunerr' || '' }} | |
| tags: | | |
| type=raw,value=latest | |
| type=raw,value=${{ env.RELEASE_TAG }} | |
| - name: Build and push Docker image | |
| id: docker-build | |
| continue-on-error: true | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: VERSION=${{ env.RELEASE_TAG }} | |
| - name: Retry Docker build and push | |
| if: steps.docker-build.outcome == 'failure' | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: VERSION=${{ env.RELEASE_TAG }} |