Skip to content

Commit c9b7784

Browse files
alles muss man selber machen
1 parent 8028899 commit c9b7784

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

.github/workflows/dockerpublish.yml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,35 @@ on:
55
branches: [ master ]
66
tags: [ ]
77

8+
env:
9+
REPO_NAME: skymatic
10+
IMAGE_NAME: apache-php-base
11+
812
jobs:
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

0 commit comments

Comments
 (0)