-
Notifications
You must be signed in to change notification settings - Fork 7.7k
111 lines (100 loc) · 3.75 KB
/
docker-release.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: '[docker] CI for releases'
on:
push:
branches:
- master
paths:
- '.github/workflows/docker-release.yml'
- 'lib/**'
- '!**/maintainer.js'
- '!**/radar.js'
- '!**/radar-rules.js'
- 'Dockerfile'
- 'package.json'
- 'yarn.lock'
workflow_dispatch: ~
jobs:
check-env:
permissions:
contents: none
runs-on: ubuntu-latest
outputs:
check-docker: ${{ steps.check-docker.outputs.defined }}
steps:
- id: check-docker
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
if: ${{ env.DOCKER_USERNAME != '' }}
run: echo "::set-output name=defined::true"
release:
runs-on: ubuntu-latest
needs: check-env
if: needs.check-env.outputs.check-docker == 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
- 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
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract Docker metadata (ordinary version)
id: meta-ordinary
uses: docker/metadata-action@v4
with:
images: ${{ secrets.DOCKER_USERNAME }}/rsshub
tags: |
type=raw,value=latest,enable=true
type=raw,value={{date 'YYYY-MM-DD'}},enable=true
flavor: latest=false
- name: Build and push Docker image (ordinary version)
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta-ordinary.outputs.tags }}
labels: ${{ steps.meta-ordinary.outputs.labels }}
platforms: linux/amd64,linux/arm/v7,linux/arm64
cache-from: type=gha,scope=docker-release
cache-to: type=gha,mode=max,scope=docker-release
# cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/rsshub:buildcache
# cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/rsshub:buildcache,mode=max
- name: Extract Docker metadata (Chromium-bundled version)
id: meta-chromium-bundled
uses: docker/metadata-action@v4
with:
images: ${{ secrets.DOCKER_USERNAME }}/rsshub
tags: |
type=raw,value=chromium-bundled,enable=true
type=raw,value=chromium-bundled-{{date 'YYYY-MM-DD'}},enable=true
flavor: latest=false
- name: Build and push Docker image (Chromium-bundled version)
uses: docker/build-push-action@v3
with:
context: .
build-args: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=0
push: true
tags: ${{ steps.meta-chromium-bundled.outputs.tags }}
labels: ${{ steps.meta-chromium-bundled.outputs.labels }}
platforms: linux/amd64,linux/arm/v7,linux/arm64
cache-from: |
type=registry,ref=${{ secrets.DOCKER_USERNAME }}/rsshub:chromium-bundled
# type=gha,scope=docker-release # not needed, Docker automatically uses local cache from the builder
# type=registry,ref=${{ secrets.DOCKER_USERNAME }}/rsshub:buildcache
cache-to: type=inline,ref=${{ secrets.DOCKER_USERNAME }}/rsshub:chromium-bundled # inline cache is enough
description:
runs-on: ubuntu-latest
needs: check-env
if: needs.check-env.outputs.check-docker == 'true'
steps:
- uses: actions/checkout@v3
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ secrets.DOCKER_USERNAME }}/rsshub