diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml new file mode 100644 index 0000000..37706bf --- /dev/null +++ b/.github/workflows/actions.yaml @@ -0,0 +1,33 @@ +on: + push: + branches: + - '**' + +jobs: + converge: + name: Converge + runs-on: ubuntu-latest + steps: + + - name: Checkout code + uses: actions/checkout@v3 + 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: | + . $(werf ci-env github --as-file) + werf export web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml new file mode 100644 index 0000000..9d00aec --- /dev/null +++ b/.github/workflows/tag.yaml @@ -0,0 +1,33 @@ +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +jobs: + converge: + name: Converge + runs-on: ubuntu-latest + steps: + + - name: Checkout code + uses: actions/checkout@v3 + 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: | + . $(werf ci-env github --as-file) + werf export web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_REF_NAME diff --git a/werf.yaml b/werf.yaml index 362eacf..1f80d69 100644 --- a/werf.yaml +++ b/werf.yaml @@ -1,32 +1,32 @@ configVersion: 1 project: "web-client" --- -image: builder # Название собираемого образа. -from: registry.gitlab.com/tokend/devops/docker-containers:front14-a7d73669fd1fa97a461226c292357bc33d478070 # Базовый образ. -git: # Секция с директивами для добавления исходных файлов из git-репозитория. - - add: / # Исходный путь в репозитории. - to: /app # Путь назначения в образе. - stageDependencies: # Настройка перевыполнения сборочных инструкций при изменениях определённых файлов в репозитории. - install: # Для стадии Install. +image: builder +from: node:16-alpine +git: + - add: / + to: /app + stageDependencies: + install: - package.json - yarn.lock - setup: # Для стадии Setup. + setup: - "**/*" -shell: # Shell сборочные инструкции. - install: # Для стадии Install. +shell: + beforeInstall: + - apk --no-cache --update --virtual build-dependencies add python make g++ + install: - cd /app #- yarn autoclean --init #- yarn autoclean --force - yarn install - setup: # Для стадии Setup. + setup: - cd /app - yarn build --- image: web -from: nginx:stable-alpine -docker: - WORKDIR: /usr/share/nginx +from: nginx:alpine git: - add: /nginx.conf to: /etc/nginx/nginx.conf @@ -35,3 +35,5 @@ import: add: /app/dist to: /usr/share/nginx/html after: setup + +