File tree Expand file tree Collapse file tree 1 file changed +62
-0
lines changed
Expand file tree Collapse file tree 1 file changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+
3+ name : Build Images Cron
4+
5+ # Rebuild images from master branch every Sunday
6+
7+ on :
8+ schedule :
9+ - cron : " 0 0 * * 0"
10+
11+ jobs :
12+ build :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Checkout
16+ uses : actions/checkout@v2
17+ with :
18+ ref : master
19+
20+ - name : Get build tag
21+ id : get_build_tag
22+ # You must push tags first before pushing refs, otherwise you'll never build an image
23+ # tagged with a git tag.
24+ run : |
25+ if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
26+ TAG="$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//g')"
27+ else
28+ TAG="$(echo ${GITHUB_REF#refs/heads/} | tr '/-' '_')-${GITHUB_SHA:0:7}-$(date -u +'%Y%m%d%H%M')"
29+ fi
30+ echo "TAG: ${TAG}"
31+ echo "::set-output name=tag::${TAG}"
32+
33+ - name : Set up Docker Buildx
34+ id : buildx
35+ uses : docker/setup-buildx-action@v1
36+
37+ - name : Cache Docker layers
38+ uses : actions/cache@v2
39+ with :
40+ path : /tmp/.buildx-cache
41+ key : ${{ runner.os }}-buildx-${{ github.sha }}
42+ restore-keys : |
43+ ${{ runner.os }}-buildx-
44+
45+ - name : Login to Docker Hub
46+ uses : docker/login-action@v1
47+ with :
48+ username : ${{ secrets.PANUBUILD_DOCKERHUB_USERNAME }}
49+ password : ${{ secrets.PANUBUILD_DOCKERHUB_TOKEN }}
50+
51+ - name : Build and Push
52+ uses : docker/build-push-action@v2
53+ with :
54+ builder : ${{ steps.buildx.outputs.name }}
55+ context : .
56+ file : Dockerfile
57+ push : true
58+ cache-from : type=local,src=/tmp/.buildx-cache
59+ cache-to : type=local,mode=max,dest=/tmp/.buildx-cache
60+ tags : |
61+ panubo/sshd:latest
62+ panubo/sshd:${{ steps.get_build_tag.outputs.tag }}
You can’t perform that action at this time.
0 commit comments