Skip to content
This repository was archived by the owner on May 19, 2024. It is now read-only.

Commit 77bfdd0

Browse files
authored
Fix docker and ghcr versioning (#32)
1 parent 39378cc commit 77bfdd0

File tree

2 files changed

+52
-4
lines changed

2 files changed

+52
-4
lines changed

.github/workflows/dockerhub.yml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ on:
1010
schedule:
1111
- cron: "5 0 * * THU" #every thursday
1212
# run it during pull request
13+
14+
env:
15+
REGISTRY: ghcr.io
16+
IMAGE_NAME: wanjohiryan/warp
17+
BASE_TAG_PREFIX: x264
18+
CHROME_TAG_PREFIX: chrome-x264
1319

1420
jobs:
1521
build-docker-base-package:
@@ -34,14 +40,31 @@ jobs:
3440
with:
3541
username: ${{ secrets.DOCKERHUB_USERNAME }}
3642
password: ${{ secrets.DOCKERHUB_TOKEN }}
43+
-
44+
name: Extract Container metadata
45+
id: meta
46+
uses: docker/metadata-action@v4
47+
with:
48+
images: ${{github.actor}}/warp
49+
flavor: |
50+
latest=${{github.ref == 'refs/tags'}}
51+
prefix=${{ env.BASE_TAG_PREFIX }}, onlatest=true
52+
#tag on release, and a nightly build for 'dev'
53+
tags: |
54+
type=raw, value=nightly, enable={{is_default_branch}}
55+
type=semver, pattern={{version}}
56+
type=semver, pattern={{major}}.{{minor}}
57+
type=semver, pattern={{major}}
3758
-
3859
name: Build and push image
3960
uses: docker/build-push-action@v3
4061
with:
4162
context: ./
4263
file: .docker/x264-base/Dockerfile
4364
push: true
44-
tags: wanjohiryan/warp:x264
65+
tags: ${{ steps.meta.outputs.tags }}
66+
labels: ${{ steps.meta.outputs.labels }}
67+
4568
build-docker-chrome:
4669
needs: build-docker-base-package
4770
runs-on: ubuntu-latest
@@ -65,11 +88,27 @@ jobs:
6588
with:
6689
username: ${{ secrets.DOCKERHUB_USERNAME }}
6790
password: ${{ secrets.DOCKERHUB_TOKEN }}
91+
-
92+
name: Extract Container metadata
93+
id: meta
94+
uses: docker/metadata-action@v4
95+
with:
96+
images: ${{github.actor}}/warp
97+
flavor: |
98+
latest=${{github.ref == 'refs/tags'}}
99+
prefix=${{ env.CHROME_TAG_PREFIX }}, onlatest=true
100+
#tag on release, and a nightly build for 'dev'
101+
tags: |
102+
type=raw, value=nightly, enable={{is_default_branch}}
103+
type=semver, pattern={{version}}
104+
type=semver, pattern={{major}}.{{minor}}
105+
type=semver, pattern={{major}}
68106
-
69107
name: Build and push image
70108
uses: docker/build-push-action@v3
71109
with:
72110
context: ./
73111
file: examples/chrome-x264/Dockerfile
74112
push: true
75-
tags: wanjohiryan/warp:chrome-x264
113+
tags: ${{ steps.meta.outputs.tags }}
114+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/ghcr.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: "Push image to ghcr"
33
on:
44
push:
55
branches: [main]
6+
tags:
7+
- v*.*.*
68

79
env:
810
REGISTRY: ghcr.io
@@ -36,11 +38,14 @@ jobs:
3638
uses: docker/metadata-action@v4
3739
with:
3840
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ env.BASE_TAG_PREFIX }}
41+
flavor: |
42+
latest=${{github.ref == 'refs/tags'}}
43+
#tag on release, and a nightly build for 'dev'
3944
tags: |
45+
type=raw,value=nightly,enable={{is_default_branch}}
4046
type=semver,pattern={{version}}
4147
type=semver,pattern={{major}}.{{minor}}
4248
type=semver,pattern={{major}}
43-
type=sha,format=long
4449
4550
- name: Build and push image
4651
uses: docker/build-push-action@v3
@@ -77,11 +82,15 @@ jobs:
7782
uses: docker/metadata-action@v4
7883
with:
7984
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ env.CHROME_TAG_PREFIX }}
85+
flavor: |
86+
latest=${{github.ref == 'refs/tags'}}
87+
#tag on release, and a nightly build for 'dev'
8088
tags: |
89+
type=raw,value=nightly,enable={{is_default_branch}}
8190
type=semver,pattern={{version}}
8291
type=semver,pattern={{major}}.{{minor}}
8392
type=semver,pattern={{major}}
84-
type=sha,format=long
93+
type=schedule,pattern=nightly
8594
8695
- name: Build and push image
8796
uses: docker/build-push-action@v3

0 commit comments

Comments
 (0)