@@ -2,8 +2,10 @@ name: Build and Push to Artifact Registry
2
2
3
3
" on " :
4
4
push :
5
- branches : ["*"]
6
- tags : ["*"]
5
+ branches :
6
+ - " *"
7
+ tags :
8
+ - " v[0-9]+.[0-9]+.[0-9]+-*"
7
9
8
10
env :
9
11
PROJECT_ID : open-targets-genetics-dev
37
39
uses : docker/setup-buildx-action@v3
38
40
39
41
- name : " Docker auth"
40
- run : |-
42
+ run : |
41
43
gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet
42
44
43
45
- name : Quick Docker build (gentropy only, AMD64 only, with layer cache)
@@ -50,22 +52,33 @@ jobs:
50
52
cache-from : type=gha
51
53
cache-to : type=gha,mode=max
52
54
55
+ # skip the `v` at the beginning of the tag for docker image tags
56
+ - name : Create a docker tag
57
+ id : docker-tag
58
+ shell : bash
59
+ env :
60
+ TAG : ${{ github.ref_name }}
61
+ run : |
62
+ TAG=$(echo $TAG | sed 's/^v//')
63
+ echo "TAG=$TAG" >> $GITHUB_ENV
64
+ echo "The tag for this build is $TAG"
65
+
53
66
- name : Build and push gentropy image
54
- if : github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/v')
67
+ if : steps.docker-tag.outcome == 'success'
55
68
uses : docker/build-push-action@v6
56
69
with :
57
70
platforms : linux/amd64,linux/arm64
58
71
push : true
59
- tags : " ${{ env.GAR_LOCATION }}/${{ env.REPOSITORY }}/gentropy:${{ github.ref_name }}"
72
+ tags : " ${{ env.GAR_LOCATION }}/${{ env.REPOSITORY }}/gentropy:${{ env.TAG }}"
60
73
context : .
61
74
62
75
- name : Build and push VEP image
63
- if : github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/v')
76
+ if : steps.docker-tag.outcome == 'success'
64
77
uses : docker/build-push-action@v6
65
78
with :
66
79
platforms : linux/amd64
67
80
push : true
68
- tags : " ${{ env.GAR_LOCATION }}/${{ env.REPOSITORY }}/custom_ensembl_vep:${{ github.ref_name }}"
81
+ tags : " ${{ env.GAR_LOCATION }}/${{ env.REPOSITORY }}/custom_ensembl_vep:${{ env.TAG }}"
69
82
context : .
70
83
file : " src/vep/Dockerfile"
71
84
0 commit comments