1
1
name : CI
2
2
3
- " on " : [push]
3
+ ' on ' :
4
+ push :
5
+ branches-ignore :
6
+ # These should always correspond to pull requests, so ignore them for
7
+ # the push trigger and let them be triggered by the pull_request
8
+ # trigger, avoiding running the workflow twice. This is a minor
9
+ # optimization so there's no need to ensure this is comprehensive.
10
+ - ' dependabot/**'
11
+ - ' renovate/**'
12
+ - ' tickets/**'
13
+ - ' u/**'
14
+ tags :
15
+ - ' *'
16
+ pull_request : {}
4
17
5
18
jobs :
6
19
lint :
@@ -60,18 +73,20 @@ jobs:
60
73
LTD_KEEPER_TEST_AWS_ID : ${{ secrets.LTD_KEEPER_TEST_AWS_ID }}
61
74
LTD_KEEPER_TEST_AWS_SECRET : ${{ secrets.LTD_KEEPER_TEST_AWS_SECRET }}
62
75
LTD_KEEPER_TEST_BUCKET : ${{ secrets.LTD_KEEPER_TEST_BUCKET }}
63
- run : tox -e typing,${{matrix.db}},coverage-report # run tox using Python in path
76
+ run : tox -e typing,${{matrix.db}},coverage-report # run tox using Python in path
64
77
65
78
- name : Run tox without external services
66
79
if : ${{ !(matrix.python != 3.9 && matrix.db != 'postgres') }}
67
- run : tox -e typing,${{matrix.db}},coverage-report # run tox using Python in path
80
+ run : tox -e typing,${{matrix.db}},coverage-report # run tox using Python in path
68
81
69
82
docs :
70
83
runs-on : ubuntu-latest
71
84
needs : [lint]
72
85
73
86
steps :
74
87
- uses : actions/checkout@v2
88
+ with :
89
+ fetch-depth : 0
75
90
76
91
- name : Set up Python
77
92
uses : actions/setup-python@v2
@@ -106,15 +121,18 @@ jobs:
106
121
needs : [test]
107
122
108
123
# Only do Docker builds of ticket branches and tagged releases, as well
109
- # as JSick Codes branches.
110
- if : startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/tickets/') || startsWith(github.ref, 'refs/heads/u/jsickcodes/')
124
+ # as J.Sick Codes branches.
125
+ # if: >
126
+ # (startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/tickets/')) || startsWith(github.ref, 'refs/heads/u/jsickcodes/')
111
127
112
128
steps :
113
129
- uses : actions/checkout@v2
130
+ with :
131
+ fetch-depth : 0
114
132
115
133
- name : Define the Docker tag
116
134
id : vars
117
- run : echo ::set-output name=tag::$(bin/docker-tag.sh "$GITHUB_REF" )
135
+ run : echo ::set-output name=tag::$(bin/docker-tag.sh)
118
136
119
137
- name : Print the tag
120
138
id : print
@@ -123,33 +141,26 @@ jobs:
123
141
- name : Set up Docker Buildx
124
142
uses : docker/setup-buildx-action@v1
125
143
126
- - name : Cache Docker layers
127
- uses : actions/cache@v2
128
- with :
129
- path : /tmp/.buildx-cache
130
- key : ${{ runner.os }}-buildx-${{ github.sha }}
131
- restore-keys :
132
- ${{ runner.os }}-buildx-
133
-
134
144
- name : Log in to Docker Hub
135
145
uses : docker/login-action@v1
136
146
with :
137
147
username : ${{ secrets.DOCKER_USERNAME }}
138
148
password : ${{ secrets.DOCKER_TOKEN }}
139
149
150
+ - name : Log in to GitHub Container Registry
151
+ uses : docker/login-action@v1
152
+ with :
153
+ registry : ghcr.io
154
+ username : ${{ github.repository_owner }}
155
+ password : ${{ secrets.GITHUB_TOKEN }}
156
+
140
157
- name : Build and push
141
158
uses : docker/build-push-action@v2
142
159
with :
143
160
context : .
144
161
push : true
145
- tags : lsstsqre/ltdkeeper:${{ steps.vars.outputs.tag }}
146
- cache-from : type=local,src=/tmp/.buildx-cache
147
- cache-to : type=local,dest=/tmp/.buildx-cache-new
148
-
149
- # Temp fix
150
- # https://github.com/docker/build-push-action/issues/252
151
- # https://github.com/moby/buildkit/issues/1896
152
- - name : Move cache
153
- run : |
154
- rm -rf /tmp/.buildx-cache
155
- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
162
+ tags : |
163
+ lsstsqre/ltdkeeper:${{ steps.vars.outputs.tag }}
164
+ ghcr.io/lsst-sqre/ltd-keeper:${{ steps.vars.outputs.tag }}
165
+ cache-from : type=gha
166
+ cache-to : type=gha,mode=max
0 commit comments