-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (106 loc) · 3.68 KB
/
docker-image.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
112
113
114
115
116
117
118
119
120
121
122
name: Build and Push Docker Image
on:
push:
branches:
- main
tags:
- '*'
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: image=moby/buildkit:latest
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Clone repo to build
run: git clone https://github.com/davidecavestro/gphotos-cdp.git repo
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
davidecavestro/gphotos-cdp:${{ github.ref_name }}
ghcr.io/davidecavestro/gphotos-cdp:${{ github.ref_name }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Push latest image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
davidecavestro/gphotos-cdp:latest
ghcr.io/davidecavestro/gphotos-cdp:latest
cache-from: type=gha
cache-to: type=gha,mode=max
if: startsWith(github.ref, 'refs/tags/')
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: davidecavestro/gphotos-cdp
short-description: ${{ github.event.repository.description }}
enable-url-completion: true
create-release:
runs-on: ubuntu-latest
needs: build-and-push
permissions: write-all
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: v${{ github.ref_name }}
body: |
Container images for this release:
- Docker Hub: `davidecavestro/gphotos-cdp:${{ github.ref_name }}`
- GitHub Container Registry: `ghcr.io/davidecavestro/gphotos-cdp:${{ github.ref_name }}`
${{ steps.changelog.outputs.changes }}
draft: false
prerelease: false
- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
file_pattern: CHANGELOG.md
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: davidecavestro/usql
short-description: ${{ github.event.repository.description }}
enable-url-completion: true