-
Notifications
You must be signed in to change notification settings - Fork 2
87 lines (85 loc) · 2.61 KB
/
driver.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
name: driver
on:
- push
- pull_request
jobs:
test-suite:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
with:
go-version: "^1.15"
- name: Run tests
run: go test ./...
- name: Run vetting/linting checks
run: go vet ./...
pr-build:
runs-on: ubuntu-latest
if: "${{ github.event.pull_request.number != ''}}"
needs: test-suite
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get PR infomation
id: pr_info
run: |
echo "PR_NUM=pr-${{ github.event.pull_request.number }}" | tee -a $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Debug
run: |
echo "${{ steps.pr_info.outputs.PR_NUM }}"
- name: Build and push (Dockerhub)
uses: docker/build-push-action@v2
with:
file: Dockerfile
push: true
build-args: |
VERSION=${{ steps.get_pr_info.outputs.PR_NUM }}
tags: |
civo/csi:${{ steps.get_pr_info.outputs.PR_NUM }}
release-build:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: test-suite
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push (Dockerhub)
uses: docker/build-push-action@v2
with:
file: Dockerfile
push: true
build-args: |
VERSION=${{ steps.tag.outputs.tag }}
tags: |
civo/csi:${{ steps.tag.outputs.tag }}
civo/csi:latest
- name: Build and push (Google Container Registry)
uses: RafikFarhad/push-to-gcr-github-action@v5-beta
with:
gcloud_service_key: ${{ secrets.GCLOUD_SERVICE_KEY }}
registry: gcr.io
project_id: consummate-yew-302509
image_name: csi
image_tag: latest,${{ steps.tag.outputs.tag }}