Skip to content

Commit 5a81010

Browse files
authored
Create docker-publish.yml
Adding github actions for dockerhub publishing
1 parent 3266b7d commit 5a81010

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
inputs:
7+
dnscrypt-proxy-release:
8+
description: 'DNSCrypt Proxy Release'
9+
required: true
10+
11+
env:
12+
REGISTRY: docker.io
13+
IMAGE_NAME: xtr0py/dnscrypt-proxy-2-docker
14+
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
env:
22+
DNSCRYPT_PROXY_VERSION: ${{ github.event.inputs.version }}
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v2
27+
28+
- name: Setup default version
29+
run: echo "DNSCRYPT_PROXY_VERSION=2.0.45" >> $GITHUB_ENV
30+
if: ${{ env.DNSCRYPT_PROXY_VERSION == '' }}
31+
32+
- name: Setup Docker buildx
33+
uses: docker/setup-buildx-action@v1
34+
35+
36+
# Login against a Docker registry except on PR
37+
- name: Log into registry ${{ env.REGISTRY }}
38+
uses: docker/login-action@v1
39+
with:
40+
registry: ${{ env.REGISTRY }}
41+
username: ${{ secrets.DOCKERHUB_USERNAME }}
42+
password: ${{ secrets.DOCKERHUB_TOKEN }}
43+
44+
45+
# Build and push Docker image with Buildx (don't push on PR)
46+
# https://github.com/docker/build-push-action
47+
- name: Build and push Docker image
48+
uses: docker/build-push-action@v2
49+
with:
50+
context: .
51+
platforms: linux/amd64
52+
build-args: VERSION=${{ env.DNSCRYPT_PROXY_VERSION }}
53+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.DNSCRYPT_PROXY_VERSION }}
54+
push: true

0 commit comments

Comments
 (0)