forked from MarkusMcNugen/docker-qBittorrentvpn
-
Notifications
You must be signed in to change notification settings - Fork 6
82 lines (80 loc) · 2.74 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: CI
on:
push:
branches: [ '**' ]
jobs:
container_build:
name: Build and Push Docker Container
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: chrisjohnson00
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Determine container tag
run: |
if [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=${GITHUB_REF#refs/heads/}
if [[ $VERSION == main ]]; then
VERSION=latest
fi
fi
echo ::set-output name=container_tag::${VERSION}
id: prep
- name: Cache Docker layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ steps.prep.outputs.container_tag }}-
${{ runner.os }}-buildx-
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
chrisjohnson00/qbittorrent-openvpn:${{ steps.prep.outputs.container_tag }}
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
labels: |
org.opencontainers.image.documentation=https://github.com/chrisjohnson00/docker-qBittorrentvpn
org.opencontainers.image.version=${{ steps.prep.outputs.container_tag }}
org.opencontainers.image.source=https://github.com/chrisjohnson00/docker-qBittorrentvpn
org.opencontainers.image.revision=${{ github.sha }}
- name: Get Qbittorrent version from container
id: qbittorrent
run: |
output=$(docker run chrisjohnson00/qbittorrent-openvpn:${{ steps.prep.outputs.container_tag }} qbittorrent-nox -v | grep -Eo "v(.*)")
echo "::set-output name=version::$(echo $output)"
- name: Display QBittorrent Version
run: |
echo $VERSION
env:
VERSION: ${{ steps.qbittorrent.outputs.version }}
actionslint:
name: Actions Yaml Lint
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Actions Yaml Lint
uses: karancode/[email protected]
with:
yamllint_file_or_dir: .github/workflows
yamllint_comment: true
yamllint_config_filepath: .yamllint
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}