-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (37 loc) · 1.1 KB
/
docker-publish.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
name: Docker
on:
push:
branches:
- main
# Run tests for any PRs.
pull_request:
env:
IMAGE_ID: ghcr.io/${{ github.repository_owner }}/cloudrun-go
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
version: [20231109, 20231116]
steps:
- uses: actions/checkout@v3
- name: Run test
run: docker build . --file ${{ matrix.version }}/Dockerfile --tag $IMAGE_ID:${{ matrix.version }}
push:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push'
strategy:
matrix:
version: [20231109, 20231116]
steps:
- uses: actions/checkout@v3
- name: Build image
run: |
docker build . --file ${{ matrix.version }}/Dockerfile --tag $IMAGE_ID:${{ matrix.version }}
- name: Log into GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image to GitHub Container Registry
run: |
echo Version=${{ matrix.version }}
docker push $IMAGE_ID:${{ matrix.version }}