File tree Expand file tree Collapse file tree 1 file changed +29
-10
lines changed
Expand file tree Collapse file tree 1 file changed +29
-10
lines changed Original file line number Diff line number Diff line change 55 branches : [ master ]
66 tags : [ ]
77
8+ env :
9+ REPO_NAME : skymatic
10+ IMAGE_NAME : apache-php-base
11+
812jobs :
9-
10- build-and-push :
13+
14+ build :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - uses : actions/checkout@v2
18+ - name : Build the Docker image
19+ run : docker build . --file Dockerfile --tag $IMAGE_NAME:$(date +%s)
20+
21+ push :
22+ needs : build # Ensure build job passes before pushing image.
1123 runs-on : ubuntu-latest
1224 steps :
13- - uses : docker/build-push-action@v1
14- with :
15- username : ${{ secrets.DOCKER_USERNAME }}
16- password : ${{ secrets.DOCKER_PASSWORD }}
17- repository : skymatic/apache-php-base
18- tag_with_ref : true
19- add_git_labels : true
20- push : true
25+ - uses : actions/checkout@v2
26+ - name : Build image
27+ run : docker build . --file Dockerfile --tag image
28+ - name : Log into registry
29+ run : echo "${{ secrets.DOCKER_PASSWORD }}" | docker login docker.pkg.github.com -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
30+ - name : Push image
31+ run : |
32+ IMAGE_ID=$REPO_NAME/$IMAGE_NAME
33+ VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
34+ [ "$VERSION" == "master" ] && VERSION=latest
35+
36+ echo VERSION=$VERSION
37+
38+ docker tag image $REPO_NAME/$IMAGE_NAME:$VERSION
39+ docker push $REPO_NAME/$IMAGE_NAME:$VERSION
You can’t perform that action at this time.
0 commit comments