Docker #2703
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 | |
on: | |
push: | |
# Publish `master` as Docker `latest` image. | |
branches: | |
- master | |
# Publish `v1.2.3` tags as releases. | |
tags: | |
- v* | |
# Nightly to capture latest base image and transmission version | |
schedule: | |
- cron: '* 21 * * *' | |
# Run tests for any PRs. | |
pull_request: | |
# Allow to trigger manually from github ui | |
workflow_dispatch: | |
jobs: | |
dockerhub-registry: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Transmission version | |
id: version | |
run: | | |
TRANSMISSION_VERSION=$(docker run --rm -i alpine:edge sh -c 'apk update -q && apk search -x transmission-daemon' | awk -F[-] '{print $3}') | |
TRANSMISSION_MAJOR_VERSION=${TRANSMISSION_VERSION%.*} | |
echo "::set-output name=full::$TRANSMISSION_VERSION" | |
echo "::set-output name=major::$TRANSMISSION_MAJOR_VERSION" | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
tingvarsson/transmission | |
flavor: | | |
latest=true | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=tag | |
type=raw,value=${{ steps.version.outputs.full }} | |
type=raw,value=${{ steps.version.outputs.short }} | |
type=raw,value=${{ steps.version.outputs.major }} | |
type=sha,format=long,prefix= | |
labels: | | |
org.opencontainers.image.version=${{ steps.version.outputs.full }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push to Docker Hub | |
uses: docker/build-push-action@v4 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |