Skip to content

Updated README

Updated README #29

Workflow file for this run

name: Build and Push Docker image
on:
push:
branches:
- main # This will trigger the workflow on push to the main branch.
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin
- name: Build and tag Docker image
run: |
docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/pg-backup:${{ github.sha }} .
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo VERSION=$VERSION
docker tag ${{ secrets.DOCKER_HUB_USERNAME }}/pg-backup:${{ github.sha }} ${{ secrets.DOCKER_HUB_USERNAME }}/pg-backup:latest
- name: Push Docker image to Docker Hub
run: |
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/pg-backup:${{ github.sha }}
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo VERSION=$VERSION
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/pg-backup:$VERSION