mirror of
https://github.com/werf/actions.git
synced 2026-02-05 10:56:23 +03:00
118 lines
3.5 KiB
Markdown
118 lines
3.5 KiB
Markdown
<p align="center">
|
|
<img src="https://github.com/flant/werf/raw/master/docs/images/werf-logo.svg?sanitize=true" style="max-height:100%;" height="175">
|
|
</p>
|
|
___
|
|
|
|
The action combines all the necessary steps in itself and logic may be divided into environment setup and launching `werf run`.
|
|
|
|
## Action in Details
|
|
|
|
### werf binary setup
|
|
|
|
By default, all actions setup actual werf version for [1.1 alpha channel](https://werf.io/releases.html) (more details about channels, werf release cycle and compatibility promise [here](https://github.com/flant/werf#backward-compatibility-promise)).
|
|
Using `group` and `channel` inputs the user can switch the release channel.
|
|
|
|
> This is recommended approach to be up-to-date and to use actual werf version without changing configurations
|
|
|
|
```yaml
|
|
- uses: flant/werf-actions/run@master
|
|
with:
|
|
group: 1.1
|
|
channel: alpha
|
|
```
|
|
|
|
Withal, it is not necessary to work within release channels, and the user might specify certain werf version with `version` input.
|
|
|
|
```yaml
|
|
- uses: flant/werf-actions/run@master
|
|
with:
|
|
version: v1.1.16
|
|
```
|
|
|
|
### kubeconfig setup (*optional*)
|
|
|
|
The _kubeconfig_ may be used for deployment, cleanup, distributed locks and caches. Thus, the configuration should be added before step with the action or passed as base64 encoded data with `kube-config-base64-data` input:
|
|
|
|
* Prepare _kubeconfig_ (e.g. `cat ~/.kube/config | base64`) and save in GitHub Project Secrets (e.g. with name `KUBE_CONFIG_BASE64_DATA`).
|
|
|
|
* Pass secret with `kube-config-base64-data` input:
|
|
|
|
```yaml
|
|
- uses: flant/werf-actions/run@master
|
|
with:
|
|
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
|
```
|
|
|
|
### werf ci-env
|
|
|
|
This command performs _docker login_ using `github-token`, sets up predefined variables based on GitHub Workflow context.
|
|
|
|
**Note** that `github-token` is optional in this action, and the input is there in case you need to use a non-default token.
|
|
|
|
By default, action will use the token provided to your workflow.
|
|
|
|
## Working with werf options
|
|
|
|
Any werf option can be defined with environment variables:
|
|
|
|
```yaml
|
|
- uses: flant/werf-actions/run@master
|
|
env:
|
|
WERF_LOG_VERBOSE: "on"
|
|
WERF_TAG_CUSTOM_TAG1: tag1
|
|
WERF_TAG_CUSTOM_TAG2: tag2
|
|
```
|
|
|
|
## Inputs
|
|
|
|
```yaml
|
|
inputs:
|
|
group:
|
|
description: 'The MAJOR.MINOR version'
|
|
default: '1.1'
|
|
required: false
|
|
channel:
|
|
description: 'The one of the following channel: alpha, beta, ea, stable, rock-solid'
|
|
default: 'alpha'
|
|
required: false
|
|
version:
|
|
description: 'The certain version'
|
|
required: false
|
|
image:
|
|
description: 'The image name from werf.yaml (werf run [options] [IMAGE_NAME] [-- COMMAND ARG...])'
|
|
required: false
|
|
args:
|
|
description: 'The specific command with arguments (werf run [options] [IMAGE_NAME] [-- COMMAND ARG...])'
|
|
required: false
|
|
github-token:
|
|
description: 'The GitHub token used to login and to interact with Docker Github Packages'
|
|
default: ${{ github.token }}
|
|
required: false
|
|
kube-config-base64-data:
|
|
description: 'Base64 encoded kubeconfig data used for deployment, cleanup and distributed locks'
|
|
required: false
|
|
```
|
|
|
|
## Example
|
|
|
|
```yaml
|
|
run:
|
|
name: Run
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Run
|
|
uses: flant/werf-actions/run@master
|
|
with:
|
|
image: backend
|
|
args: rails server
|
|
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
|
env:
|
|
WERF_DOCKER_OPTIONS: "-d -p 3000:3000"
|
|
```
|