File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Publish Docker image to pkg.github.com
2+
3+ # https://help.github.com/en/actions/reference/events-that-trigger-workflows
4+ on :
5+ # push: # debug
6+ release :
7+ types : [ published ]
8+
9+ jobs :
10+ build :
11+ # shared env variables
12+ env :
13+ DOCKER_REPOSITORY : docker.pkg.github.com
14+ DOCKER_IMAGE_NAME : elecena/python-php/base # follow OWNER/REPOSITORY/IMAGE_NAME schema
15+ DOCKER_PUSH_USER : elecena # this can be anything, Github token is used to log into the registry
16+
17+ runs-on : ubuntu-latest
18+ steps :
19+ - uses : actions/checkout@master
20+
21+ # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
22+ # e.g. docker.pkg.github.com/elecena/backend/bots-worker:1.9
23+ - name : Set Docker image name and release tag
24+ run : echo "DOCKER_TAG=${DOCKER_REPOSITORY}/${DOCKER_IMAGE_NAME}:${GITHUB_REF:10}" >> $GITHUB_ENV
25+
26+ - name : Build the Docker image
27+ run : docker build . --tag ${DOCKER_TAG} --build-arg GITHUB_SHA=${GITHUB_SHA}
28+
29+ # https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow
30+ - name : Log in and publish to Registry
31+ run : |
32+ echo ${{ secrets.GITHUB_TOKEN }} | docker login ${DOCKER_REPOSITORY} -u ${DOCKER_PUSH_USER} --password-stdin
33+ docker push ${DOCKER_TAG}
You can’t perform that action at this time.
0 commit comments