Skip to content

Commit 37acda7

Browse files
authored
Migrate ci to skaffold (#29)
* Migrate CI to skaffold * Remove test branch from ci * Update node version to 18 * Remove 'Install werf' stage from CI
1 parent 60ad0d7 commit 37acda7

File tree

5 files changed

+62
-61
lines changed

5 files changed

+62
-61
lines changed

.github/workflows/actions.yaml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,28 @@ jobs:
1414
with:
1515
fetch-depth: 0
1616

17-
- name: Install werf
18-
uses: werf/actions/install@v1.2
19-
2017
- name: Log in to registry
2118
# This is where you will update the personal access token to GITHUB_TOKEN
2219
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
2320

24-
- name: Run echo
25-
run: |
26-
werf version
27-
docker version
28-
echo $GITHUB_REPOSITORY
29-
echo $GITHUB_SHA
30-
- name: Run Build
21+
- name: Cache layers
22+
uses: actions/cache@v3
23+
with:
24+
path: "${{ github.workspace }}/.skaffold/cache"
25+
key: skaffold-${{ hashFiles('**/cache') }}
26+
restore-keys: |
27+
skaffold-
28+
29+
- name: Set up environment variables
3130
run: |
32-
. $(werf ci-env github --as-file)
3331
echo "${{ secrets.STAGE_ENV }}" > .env.deploy
34-
werf export web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA --dev
32+
33+
- name: Run Skaffold pipeline as command
34+
uses: hiberbee/github-action-skaffold@1.27.0
35+
id: build
36+
with:
37+
command: build --tag ${{ github.sha }}
38+
repository: ghcr.io/${{ github.repository_owner }}
3539

3640
stage-deploy:
3741
name: Deploy on stage

.github/workflows/tag.yaml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,29 @@ jobs:
1414
with:
1515
fetch-depth: 0
1616

17-
- name: Install werf
18-
uses: werf/actions/install@v1.2
19-
2017
- name: Log in to registry
2118
# This is where you will update the personal access token to GITHUB_TOKEN
2219
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
2320

24-
- name: Run echo
25-
run: |
26-
werf version
27-
docker version
28-
echo $GITHUB_REPOSITORY
29-
echo $GITHUB_REF_NAME
30-
- name: Run Build
21+
- name: Cache layers
22+
uses: actions/cache@v3
23+
with:
24+
path: "${{ github.workspace }}/.skaffold/cache"
25+
key: skaffold-${{ hashFiles('**/cache') }}
26+
restore-keys: |
27+
skaffold-
28+
29+
- name: Set up environment variables
3130
run: |
32-
. $(werf ci-env github --as-file)
3331
echo "${{ secrets.PROD_ENV }}" > .env.deploy
34-
werf export web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_REF_NAME --dev
32+
33+
- name: Run Skaffold pipeline as command
34+
uses: hiberbee/github-action-skaffold@1.27.0
35+
id: build
36+
with:
37+
command: build --tag ${{ github.ref_name }}
38+
repository: ghcr.io/${{ github.repository_owner }}
39+
3540
prod-deploy:
3641
name: Deploy on prod
3742
needs: converge

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM node:18-alpine AS builder
2+
3+
WORKDIR /app
4+
5+
COPY package.json package-lock.json ./
6+
COPY .env.deploy .env
7+
8+
RUN npm install
9+
10+
COPY . .
11+
12+
RUN npm run build
13+
14+
FROM nginx:alpine AS web
15+
16+
COPY nginx.conf /etc/nginx/nginx.conf
17+
18+
COPY --from=builder /app/build /usr/share/nginx/html
19+
20+
# Expose port 80
21+
EXPOSE 80
22+
23+
# Start Nginx
24+
CMD ["nginx", "-g", "daemon off;"]

skaffold.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: skaffold/v2beta28
2+
kind: Config
3+
build:
4+
artifacts:
5+
- image: docs

werf.yaml

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)