File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- name : My Pi Image
1+ name : Docker Build/Publish Image
22on :
33 push :
4- branches : [ main ]
5-
6- jobs :
7- build :
8- runs-on : ubuntu-latest
9- steps :
10- - uses : actions/checkout@v2
11- - uses : faddat/imager@v1
12- - name : Shrink The Device Image
13- run : sudo pishrink.sh -a -Z -v ubuntu-20.04.img
14- - name : Upload artifacts
15- uses : actions/upload-artifact@v2
16- with :
17- name : Your Pi Image
18- path : ubuntu-20.04.img.xz
4+ branches : [ master ]
5+ jobs :
6+ build :
7+ runs-on : ubuntu-18.04
8+ env :
9+ DOCKER_REGISTRY : registry.hub.docker.com/pathonscript/botsofcode
10+ DOCKER_IMAGE : pathonscript/botsofcode
11+ DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
12+ DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
13+ DOCKER_TARGET_PLATFORM : linux/arm/v7
14+ steps :
15+ - name : Checkout the code
16+ uses : actions/checkout@v1
17+ - name : Set up Docker Buildx
18+ uses : crazy-max/ghaction-docker-buildx@v1
19+ with :
20+ version : latest
21+ - name : Prepare
22+ if : success()
23+ id : prepare
24+ run : |
25+ echo ::set-output name=docker_platform::${DOCKER_TARGET_PLATFORM}
26+ echo ::set-output name=docker_image::${DOCKER_REGISTRY}/${DOCKER_IMAGE}
27+ echo ::set-output name=version::${GITHUB_RUN_NUMBER}
28+ - name : Docker Login
29+ if : success()
30+ run : |
31+ echo "${DOCKER_PASSWORD}" | docker login ${DOCKER_REGISTRY} --username "${DOCKER_USERNAME}" --password-stdin
32+ - name : Run Buildx (push image)
33+ if : success()
34+ run : |
35+ docker buildx build \ --platform ${{ steps.prepare.outputs.docker_platform }} \ --tag ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} \ --file ./Dockerfile \ --output type=image,push=true .
You can’t perform that action at this time.
0 commit comments