Merge pull request #2 from mogeko:dev

automatic update via CI

* build(ci): test the image compilation

* build(ci): auto update dependencies via Dependabot

* build(ci): gen image meta with docker/metadata-action

* build(ci): automatic update via CI
This commit is contained in:
Mogeko 2021-11-15 19:54:13 +01:00 committed by GitHub
commit 44bd02f731
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 166 additions and 1 deletions

View file

@ -11,7 +11,8 @@
"settings": {},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-azuretools.vscode-docker"
"ms-azuretools.vscode-docker",
"github.vscode-pull-request-github"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.

14
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,14 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
# Maintain dependencies for docker
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"

82
.github/workflows/auto-update.yml vendored Normal file
View file

@ -0,0 +1,82 @@
name: update-bot
on:
schedule:
- cron: '30 20 * * *'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
check:
runs-on: ubuntu-latest
outputs:
is_new: ${{ steps.check_ver.outputs.is_new }}
version: ${{ steps.check_ver.outputs.version }}
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})
if [ "$NEW_VER" != "$OLD_VER" ]; then
echo "::set-output name=is_new::true"
else
echo "::set-output name=is_new::false"
fi
echo "::set-output name=version::${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.is_new }}
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=edge
type=schedule,pattern={{date 'YYYYMMDD'}}
type=raw,${{ needs.check.outputs.version }}
- name: Build and push Docker image
id: build
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ needs.check.outputs.version }}
- name: Save metadata
run: echo ${{ toJSON(steps.build.outputs.metadata) }} > ${{ github.workspace }}/meta.json
- name: Update metadata
uses: actions/upload-artifact@v2
with:
name: metadata
path: ${{ github.workspace }}/meta.json

68
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,68 @@
name: Build Container
on:
push:
branches-ignore:
- master
pull_request:
branches:
- master
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
check:
runs-on: ubuntu-latest
outputs:
is_new: ${{ steps.check_ver.outputs.is_new }}
version: ${{ steps.check_ver.outputs.version }}
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})
if [ "$NEW_VER" != "$OLD_VER" ]; then
echo "::set-output name=is_new::true"
else
echo "::set-output name=is_new::false"
fi
echo "::set-output name=version::${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.is_new }}
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@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=edge
type=schedule,pattern={{date 'YYYYMMDD'}}
type=raw,${{ needs.check.outputs.version }}
- 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