Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate ci from werf to skaffold #51

Merged
merged 6 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
on:
workflow_dispatch:

env:
BASE_URL: "/"
URL: "https://staging.docs.rarimo.com"
STAGING: "true"

jobs:
converge:
name: Converge
Expand All @@ -12,23 +17,22 @@ jobs:
with:
fetch-depth: 0

- name: Install werf
uses: werf/actions/install@v1.2

- name: Log in to registry
# This is where you will update the personal access token to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Run echo
run: |
werf version
docker version
echo $GITHUB_REPOSITORY
echo $GITHUB_SHA
- name: Run Build
run: |
export URL="https://staging.docs.rarimo.com"
export BASE_URL="/"
export STAGING="true"
. $(werf ci-env github --as-file)
werf export --dev web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Cache layers
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/.skaffold/cache"
key: skaffold-${{ hashFiles('**/cache') }}
restore-keys: |
skaffold-

- name: Run Skaffold pipeline as command
uses: hiberbee/github-action-skaffold@latest
id: build
with:
command: build --tag ${{ github.sha }}
repository: ghcr.io/${{ github.repository_owner }}
39 changes: 19 additions & 20 deletions .github/workflows/actions_onlymain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ on:
push:
branches:
- 'main'
- 'devops/ci'

env:
IMAGE_NAME: ghcr.io/${{ github.repository }}:${{github.sha}}
URL: "https://staging.docs.rarimo.com"
DOMAIN: staging.docs.rarimo.com
BASE_URL: "/"
STAGING: "true"

jobs:
converge:
Expand All @@ -19,29 +22,25 @@ jobs:
with:
fetch-depth: 0

- name: Install werf
uses: werf/actions/install@v1.2

- name: Log in to registry
# This is where you will update the personal access token to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Run echo
run: |
werf version
docker version
echo $GITHUB_REPOSITORY
echo $GITHUB_SHA
- name: Run Build
env: # Or as an environment variable
BASE_URL: "/"
STAGING: "true"
run: |
export URL="https://staging.docs.rarimo.com"
export BASE_URL="/"
export STAGING="true"
. $(werf ci-env github --as-file)
werf export --dev web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Cache layers
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/.skaffold/cache"
key: skaffold-${{ hashFiles('**/cache') }}
restore-keys: |
skaffold-

- name: Run Skaffold pipeline as command
uses: hiberbee/github-action-skaffold@latest
id: build
with:
command: build --tag ${{ github.sha }}
repository: ghcr.io/${{ github.repository_owner }}

deploy:
name: Deploy
Expand Down
37 changes: 19 additions & 18 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ on:

env:
IMAGE_NAME: ghcr.io/${{ github.repository }}:${{github.ref_name}}
URL: "https://staging.docs.rarimo.com"
URL: "https://docs.rarimo.com"
DOMAIN: staging.docs.rarimo.com
BASE_URL: "/"
STAGING: "false"

jobs:
converge:
Expand All @@ -19,26 +21,25 @@ jobs:
with:
fetch-depth: 0

- name: Install werf
uses: werf/actions/install@v1.2

- name: Log in to registry
# This is where you will update the personal access token to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Run echo
run: |
werf version
docker version
echo $GITHUB_REPOSITORY
echo $GITHUB_REF_NAME
- name: Run Build
run: |
export URL="https://docs.rarimo.com"
export BASE_URL="/"
export STAGING="false"
. $(werf ci-env github --as-file)
werf export --dev web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_REF_NAME
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Cache layers
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/.skaffold/cache"
key: skaffold-${{ hashFiles('**/cache') }}
restore-keys: |
skaffold-

- name: Run Skaffold pipeline as command
uses: hiberbee/github-action-skaffold@latest
id: build
with:
command: build --tag ${{ github.ref_name }}
repository: ghcr.io/${{ github.repository_owner }}

deploy:
name: Deploy
Expand Down
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:18-alpine3.18 as builder
RUN apk update && apk --no-cache add git

ARG BASE_URL
ARG URL
ARG STAGING

WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn

COPY . .
RUN yarn build

FROM nginx:1.20.2-alpine
COPY nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /app/build /usr/share/nginx/html
10 changes: 10 additions & 0 deletions skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: skaffold/v2beta28
kind: Config
build:
artifacts:
- image: docs
docker:
buildArgs:
BASE_URL: "{{.BASE_URL}}"
URL: "{{.URL}}"
STAGING: "{{.STAGING}}"
4 changes: 0 additions & 4 deletions werf-giterminism.yaml

This file was deleted.

41 changes: 0 additions & 41 deletions werf.yaml

This file was deleted.

Loading