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 : Build and publish Docker image to ghcr.io
2+ on :
3+ # publish on releases, e.g. v2.1.13 (image tagged as "2.1.13" - "v" prefix is removed)
4+ release :
5+ types : [published]
6+
7+ # publish on pushes to the main branch (image tagged as "latest")
8+ push :
9+ # branches:
10+ # - main
11+ # - master
12+ paths :
13+ - " urNode-backend/**"
14+ # allow manual triggers
15+ workflow_dispatch :
16+
17+ jobs :
18+ publish-backend-image-to-ghcr :
19+ runs-on : ubuntu-latest
20+
21+ steps :
22+ - uses : actions/checkout@v3
23+
24+ # https://github.community/t/github-actions-repository-name-must-be-lowercase/184924
25+ - name : downcase REPO & set branch/image tag name
26+ run : |
27+ echo "REPO_LC=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
28+ export "BRANCH=${GITHUB_REF##*/}"
29+ if [ $BRANCH == "main" ] || [ $BRANCH == "master" ]; then
30+ echo "TAG=latest" >> ${GITHUB_ENV};
31+ else
32+ echo "TAG=${BRANCH}" >> ${GITHUB_ENV};
33+ fi
34+
35+ # https://github.com/marketplace/actions/push-to-ghcr
36+ - name : Build and publish a Docker image for ${{ github.repository }}
37+ uses : macbre/push-to-ghcr@master
38+ with :
39+ image_name : ${REPO_LC}-backend
40+ image_tag : ${{ env.TAG }}
41+ github_token : ${{ secrets.GITHUB_TOKEN }}
42+ # optionally push to the Docker Hub (docker.io)
43+ # docker_io_token: ${{ secrets.DOCKER_IO_ACCESS_TOKEN }} # see https://hub.docker.com/settings/security
You can’t perform that action at this time.
0 commit comments