docker-qbittorrent/.github/workflows/build.yml
2021-11-15 22:43:19 +00:00

65 lines
1.9 KiB
YAML

name: Build Container
on:
push:
branches-ignore:
- master
pull_request:
branches:
- master
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/qbittorrent
jobs:
check:
runs-on: ubuntu-latest
outputs:
old_ver: ${{ steps.check_ver.outputs.old_ver }}
new_ver: ${{ steps.check_ver.outputs.new_ver }}
steps:
- name: Check version
id: check_ver
run: |
get_ver() (curl -s "$@" | grep -Po "(\d+\.)+\d+\-r\d+" | head -1)
OLD_VER=$(get_ver ${GHCO_URL})
NEW_VER=$(get_ver ${ALPINE_PKG_URL})
echo "::set-output name=old_ver::${OLD_VER}"
echo "::set-output name=new_ver::${NEW_VER}"
env:
ALPINE_PKG_URL: https://pkgs.alpinelinux.org/package/edge/testing/x86_64/qbittorrent-nox
GHCO_URL: https://github.com/mogeko/docker-qbittorrent/pkgs/container/qbittorrent
build:
runs-on: ubuntu-latest
needs: check
if: ${{ needs.check.outputs.old_ver != needs.check.outputs.new_ver }}
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@548e2346a9987b56d8a4104fe776321ff8e23440
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=edge
type=schedule,pattern={{date 'YYYYMMDD'}}
type=raw,${{ needs.check.outputs.version }}
type=raw,latest
- name: Save status
run: echo ${{ toJSON(steps.meta.outputs.json) }} > ${{ github.workspace }}/status.json
- name: Update status
uses: actions/upload-artifact@v2
with:
name: status
path: ${{ github.workspace }}/status.json