-
Notifications
You must be signed in to change notification settings - Fork 56
39 lines (36 loc) · 1.3 KB
/
push-image.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
name: LatestImage
on:
push:
branches: [main]
jobs:
build-and-push:
# prevent job running from forked repository, otherwise
# 1. running on the forked repository would fail as missing necessary secret.
# 2. running on the forked repository would use unnecessary GitHub Action time.
if: ${{ github.repository == 'karmada-io/dashboard' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Build
run: |
echo "start build"
npm install
npm run build
docker build . --file Dockerfile --tag ${{ secrets.SWR_REGISTRY }}/karmada-dashboard:latest
- name: Login in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ secrets.SWR_REGISTRY }}
username: ${{ secrets.SWR_REGISTRY_USER_NAME }}
password: ${{ secrets.SWR_REGISTRY_PASSWORD }}
- name: Push image
run: |
echo "push image"
docker push ${{ secrets.SWR_REGISTRY }}/karmada-dashboard:latest