generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 11
99 lines (83 loc) · 2.81 KB
/
ci.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
88
89
90
91
92
93
94
95
96
97
98
99
name: Tests
on: ['push']
jobs:
test1:
name: Test push from docker hub to quay
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get image tag from commit hash
run: |
SHORT_HASH=$(git rev-parse --short "$GITHUB_SHA")
echo "TAG=${SHORT_HASH}" >> $GITHUB_ENV
- name: Login Quay
uses: docker/login-action@v1
with:
registry: 'quay.io'
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Login Dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Test retag and pushing image
uses: akhilerm/tag-push-action@main
with:
src: docker.io/openebs/linux-utils:ci
dst: |
quay.io/akhilerm/linux-utils:${{ env.TAG }}
- name: Verify pushed image
# pull both images and check if hash is same
run: |
docker pull openebs/linux-utils:ci
docker pull quay.io/akhilerm/linux-utils:${{ env.TAG }}
HASH1=$(docker images -q openebs/linux-utils:ci)
HASH2=$(docker images -q quay.io/akhilerm/linux-utils:${{ env.TAG }})
test $HASH1 = $HASH2
test2:
name: Test push from quay to docker hub
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get image tag from commit hash
run: |
SHORT_HASH=$(git rev-parse --short "$GITHUB_SHA")
echo "TAG=${SHORT_HASH}" >> $GITHUB_ENV
- name: Login Dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login Quay
uses: docker/login-action@v1
with:
registry: 'quay.io'
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Test retag and pushing image
uses: akhilerm/tag-push-action@main
with:
src: quay.io/openebs/linux-utils:ci
dst: |
docker.io/akhilerm/linux-utils:${{ env.TAG }}
- name: Verify pushed image
# pull both images and check if hash is same
run: |
docker pull quay.io/openebs/linux-utils:ci
docker pull akhilerm/linux-utils:${{ env.TAG }}
HASH1=$(docker images -q quay.io/openebs/linux-utils:ci)
HASH2=$(docker images -q akhilerm/linux-utils:${{ env.TAG }})
test $HASH1 = $HASH2
test3:
name: Unit Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install
run: npm install
- name: Test
run: npm test