Update README.md #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# EDIT this workflow name | |
name: Push to ghcr | |
on: | |
push: | |
branches: [ master ] | |
tags: [ 'v*' ] | |
env: | |
# EDIT this env variable | |
IMAGE_ID: ghcr.io/approach0/rsyncd | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build image | |
run: docker build . --file Dockerfile --tag tmp | |
# EDIT this Docker registry credentials | |
- name: Docker registry login | |
run: echo "${{ secrets.GITHUBPAT }}" | docker login ghcr.io -u 't-k-' --password-stdin | |
- name: Push image | |
run: | | |
# Example "ref": "refs/tags/0.3.1" | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's@.*/\(.*\)@\1@') | |
[ "$VERSION" == "master" ] && VERSION=latest | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag tmp $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION |