Update README.md #15
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
name: Docker Image CI | |
on: | |
push: | |
branches: [ "develop", "master" ] | |
# Publish semver tags as releases. | |
tags: [ 'v*.*.*' ] | |
pull_request: | |
branches: [ "develop" ] | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: ${{ github.repository }} | |
# github.ref as branch | |
BRANCH: ${{ github.ref_name }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: set lower case owner name | |
run: | | |
echo "IMAGE_NAME_LC=${IMAGE_NAME,,}" >>${GITHUB_ENV} | |
env: | |
IMAGE_NAME: ${{ github.repository }} | |
- name: Build the Docker image | |
if: github.event_name != 'pull_request' | |
run: docker build . --file Dockerfile -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:$(date +%s) -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:latest -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:${{ env.BRANCH }} --label "org.opencontainers.image.source=https://github.com/TheUltimateC0der/alternatrr" --label "org.opencontainers.image.description=alternatrr lets you add alternative titles to your sonarr instance by editing the sonarr.db file directly via a simple UI." --label "org.opencontainers.image.licenses=AGPL3" | |
- name: Docker Login | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1.14.1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push docker image | |
run: docker push -a ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }} |