@@ -3,8 +3,7 @@ name: build
3
3
on :
4
4
push :
5
5
branches :
6
- - ' master'
7
- - ' v*'
6
+ - ' **'
8
7
tags :
9
8
- ' v*'
10
9
paths-ignore :
23
22
- ' mkdocs.yml'
24
23
25
24
jobs :
26
-
27
25
go :
28
26
runs-on : ubuntu-latest
29
27
steps :
@@ -84,28 +82,24 @@ jobs:
84
82
docker :
85
83
runs-on : ubuntu-latest
86
84
needs : go
85
+ env :
86
+ DOCKERHUB_SLUG : crazymax/ftpgrab
87
+ GHCR_SLUG : ghcr.io/crazy-max/ftpgrab
87
88
steps :
88
89
-
89
90
name : Checkout
90
91
91
92
-
92
- name : Prepare
93
- id : prep
94
- run : |
95
- DOCKER_IMAGE=crazymax/ftpgrab
96
- VERSION=edge
97
- if [[ $GITHUB_REF == refs/tags/* ]]; then
98
- VERSION=${GITHUB_REF#refs/tags/v}
99
- fi
100
- TAGS="${DOCKER_IMAGE}:${VERSION}"
101
- if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
102
- TAGS="$TAGS,${DOCKER_IMAGE}:latest"
103
- fi
104
- echo ::set-output name=docker_image::${DOCKER_IMAGE}
105
- echo ::set-output name=version::${VERSION}
106
- echo ::set-output name=tags::${TAGS}
107
- echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
108
- echo ::set-output name=vcs_ref::${GITHUB_SHA::8}
93
+ name : Docker meta
94
+ id : docker_meta
95
+ uses : crazy-max/ghaction-docker-meta@v1
96
+ with :
97
+ images : |
98
+ ${{ env.DOCKERHUB_SLUG }}
99
+ ${{ env.GHCR_SLUG }}
100
+ tag-edge : true
101
+ tag-match : v(.*)
102
+ tag-match-group : 1
109
103
-
110
104
name : Set up QEMU
111
105
uses : docker/setup-qemu-action@v1
@@ -121,26 +115,41 @@ jobs:
121
115
with :
122
116
username : ${{ secrets.DOCKER_USERNAME }}
123
117
password : ${{ secrets.DOCKER_PASSWORD }}
118
+ -
119
+ name : Login to GHCR
120
+ if : github.event_name != 'pull_request'
121
+
122
+ with :
123
+ registry : ghcr.io
124
+ username : ${{ secrets.GHCR_USERNAME }}
125
+ password : ${{ secrets.GHCR_TOKEN }}
124
126
-
125
127
name : Build
126
128
uses : docker/build-push-action@v2
127
129
with :
128
130
context : .
129
131
file : ./Dockerfile
130
132
platforms : linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x
131
- push : ${{ github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/')) }}
132
- tags : ${{ steps.prep .outputs.tags }}
133
+ push : ${{ github.event_name != 'pull_request' }}
134
+ tags : ${{ steps.docker_meta .outputs.tags }}
133
135
build-args : |
134
- VERSION=${{ steps.prep.outputs.version }}
135
- BUILD_DATE=${{ steps.prep.outputs.build_date }}
136
- VCS_REF=${{ steps.prep.outputs.vcs_ref }}
136
+ VERSION=${{ steps.docker_meta.outputs.version }}
137
+ labels : |
138
+ ${{ steps.docker_meta.outputs.labels }}
139
+ org.opencontainers.image.title=FTPGrab
140
+ org.opencontainers.image.description=Grab your files periodically from a remote FTP or SFTP server easily
141
+ org.opencontainers.image.vendor=CrazyMax
137
142
-
138
143
name : Check manifest
139
- if : github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/'))
144
+ if : github.event_name != 'pull_request'
140
145
run : |
141
- docker buildx imagetools inspect ${{ steps.prep.outputs.docker_image }}:${{ steps.prep.outputs.version }}
146
+ docker buildx imagetools inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.docker_meta.outputs.version }}
147
+ docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:${{ steps.docker_meta.outputs.version }}
142
148
-
143
- name : Check pull
144
- if : github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/'))
149
+ name : Inspect image
150
+ if : github.event_name != 'pull_request'
145
151
run : |
146
- docker pull ${{ steps.prep.outputs.docker_image }}:${{ steps.prep.outputs.version }}
152
+ docker pull ${{ env.DOCKERHUB_SLUG }}:${{ steps.docker_meta.outputs.version }}
153
+ docker image inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.docker_meta.outputs.version }}
154
+ docker pull ${{ env.GHCR_SLUG }}:${{ steps.docker_meta.outputs.version }}
155
+ docker image inspect ${{ env.GHCR_SLUG }}:${{ steps.docker_meta.outputs.version }}
0 commit comments