mirror of
https://github.com/werf/actions.git
synced 2026-02-09 04:46:24 +03:00
Compare commits
83 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72a1f765ae | ||
|
|
43d2310151 | ||
|
|
0980fb9532 | ||
|
|
cd8e56a2c0 | ||
|
|
43075e4ab8 | ||
|
|
ed26ed00c3 | ||
|
|
123d59749a | ||
|
|
6a22d9889e | ||
|
|
c3991e000a | ||
|
|
8114de503a | ||
|
|
5db804bda8 | ||
|
|
49d9f0474c | ||
|
|
249bcf41aa | ||
|
|
9ef247eabe | ||
|
|
a8aa170653 | ||
|
|
51f5846897 | ||
|
|
6b2343319a | ||
|
|
04d17c706c | ||
|
|
9039bc0466 | ||
|
|
c8117305fa | ||
|
|
bbed6a352f | ||
|
|
28fbbd1431 | ||
|
|
3f75d958ee | ||
|
|
d70c5589dc | ||
|
|
97dd67885d | ||
|
|
32d35676c4 | ||
|
|
f97e5aaef8 | ||
|
|
5bad6adea1 | ||
|
|
b6cb5eb2b8 | ||
|
|
dc1f37e772 | ||
|
|
61d4c969a9 | ||
|
|
4cbd75c9ef | ||
|
|
66381be661 | ||
|
|
434520bcb6 | ||
|
|
e5e6d49cdd | ||
|
|
124534d1bb | ||
|
|
5b66dc4131 | ||
|
|
ed5a3d1e9b | ||
|
|
3729ed90a5 | ||
|
|
e1fbd124d8 | ||
|
|
0617fd4cf8 | ||
|
|
c05acfa9d8 | ||
|
|
5b9769fd62 | ||
|
|
6545aa68e3 | ||
|
|
bd2180a34d | ||
|
|
efd32e8190 | ||
|
|
0fed75c13c | ||
|
|
5aa19beb9e | ||
|
|
84fc1961b2 | ||
|
|
8f92bdfbf0 | ||
|
|
c8d9dcbd53 | ||
|
|
6f7411b1c0 | ||
|
|
00a90c715d | ||
|
|
cae57c1fe2 | ||
|
|
5201be8745 | ||
|
|
86a1f64ff2 | ||
|
|
d498415460 | ||
|
|
850bbb65ad | ||
|
|
a73b4d34fd | ||
|
|
3dbf8c10c0 | ||
|
|
01d8c1ceea | ||
|
|
b7ed64f2df | ||
|
|
2b23b0c4ff | ||
|
|
283070759b | ||
|
|
56a4bc82d3 | ||
|
|
7c46a8aac9 | ||
|
|
3e6d892594 | ||
|
|
b03f6749c6 | ||
|
|
2ce1908426 | ||
|
|
3869de4804 | ||
|
|
b2e09d839f | ||
|
|
23596d318c | ||
|
|
1802a119b1 | ||
|
|
8f134231c2 | ||
|
|
2bf444c364 | ||
|
|
8e55e7d93d | ||
|
|
4d1cac7064 | ||
|
|
d8c14de78e | ||
|
|
ca52a4e8ec | ||
|
|
6e29948fe2 | ||
|
|
8037e10244 | ||
|
|
432a3754b4 | ||
|
|
2df7b68580 |
12
.github/workflows/test.yaml
vendored
12
.github/workflows/test.yaml
vendored
@@ -1,6 +1,10 @@
|
||||
name: Test
|
||||
on:
|
||||
push:
|
||||
schedule:
|
||||
- cron: "0 8 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
jobs:
|
||||
channel:
|
||||
@@ -12,7 +16,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -31,13 +35,13 @@ jobs:
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install
|
||||
uses: ./install
|
||||
with:
|
||||
version: v1.1.23+fix50
|
||||
version: v1.2.35
|
||||
|
||||
- run: werf version
|
||||
- run: werf version
|
||||
|
||||
293
README.md
293
README.md
@@ -3,110 +3,11 @@
|
||||
</p>
|
||||
___
|
||||
|
||||
This action set allows you to organize CI/CD with GitHub Actions and [werf](https://github.com/werf/werf). The set consists of several independent and complex actions:
|
||||
This action allows you to organize CI/CD with GitHub Actions and [werf](https://github.com/werf/werf).
|
||||
|
||||
- [werf/actions/converge](https://github.com/werf/actions/tree/v1.1/converge)
|
||||
- [werf/actions/build-and-publish](https://github.com/werf/actions/tree/v1.1/build-and-publish)
|
||||
- [werf/actions/build](https://github.com/werf/actions/tree/v1.1/build)
|
||||
- [werf/actions/publish](https://github.com/werf/actions/tree/v1.1/build)
|
||||
- [werf/actions/deploy](https://github.com/werf/actions/tree/v1.1/deploy)
|
||||
- [werf/actions/dismiss](https://github.com/werf/actions/tree/v1.1/dismiss)
|
||||
- [werf/actions/run](https://github.com/werf/actions/tree/v1.1/run)
|
||||
- [werf/actions/cleanup](https://github.com/werf/actions/tree/v1.1/cleanup)
|
||||
**Ready-to-use GitHub Actions Workflows** for different CI/CD workflows are available [here](https://werf.io/documentation/v1.2/advanced/ci_cd/github_actions.html#complete-set-of-configurations-for-ready-made-workflows).
|
||||
|
||||
Each action combines all the necessary steps in itself and logic may be divided into environment setup and launching the corresponding command.
|
||||
|
||||
**Ready-to-use GitHub Actions Workflows** for different CI/CD workflows are available [here](https://werf.io/v1.1-alpha/documentation/guides/github_ci_cd_integration.html#complete-set-of-configurations-for-ready-made-workflows).
|
||||
|
||||
> Also, there is another action — [werf/actions/install](https://github.com/werf/actions/tree/v1.1/install). With this action a user can just install werf and use binary within job steps for own purposes
|
||||
|
||||
## Versioning
|
||||
|
||||
When using actions, select the version corresponding to the `MAJOR.MINOR` version of werf:
|
||||
|
||||
```yaml
|
||||
# run converge with actual werf version for 1.1 alpha channel
|
||||
- uses: werf/actions/converge@v1.1
|
||||
|
||||
# run converge with actual werf version for 1.2 alpha channel
|
||||
- uses: werf/actions/converge@v1.2
|
||||
```
|
||||
|
||||
## Environment setup in details
|
||||
|
||||
### werf binary setup
|
||||
|
||||
By default, all actions setup actual werf version for 1.1 alpha channel (more details about channels, werf release cycle and compatibility promise [here](https://werf.io/installation.html#all-changes-in-werf-go-through-all-stability-channels)).
|
||||
Using the `channel` input 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: werf/actions/converge@v1.1
|
||||
with:
|
||||
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: werf/actions/converge@v1.1
|
||||
with:
|
||||
version: v1.1.23
|
||||
```
|
||||
|
||||
### 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: werf/actions/build-and-publish@v1.1
|
||||
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: werf/actions/build-and-publish@v1.1
|
||||
env:
|
||||
WERF_LOG_VERBOSE: "on"
|
||||
WERF_TAG_CUSTOM_TAG1: tag1
|
||||
WERF_TAG_CUSTOM_TAG2: tag2
|
||||
```
|
||||
|
||||
## Working with container registry
|
||||
|
||||
Due to the fact that the new GitHub container registry (`ghcr.io`) does not currently support removal, all actions default to the old one (`docker.pkg.github.com`).
|
||||
|
||||
If necessary, the user can define an arbitrary container registry using the `WERF_REPO` and `WERF_REPO_IMPLEMENTATION` environment variables.
|
||||
|
||||
```yaml
|
||||
- uses: werf/actions/converge@v1.1
|
||||
env:
|
||||
WERF_REPO: "gcr.io/company/app"
|
||||
WERF_REPO_IMPLEMENTATION: "gcr"
|
||||
```
|
||||
|
||||
To learn how to work with the different container registries, see the corresponding [article in the werf documentation](https://werf.io/v1.1-alpha/documentation/reference/working_with_docker_registries.html).
|
||||
|
||||
## Examples
|
||||
|
||||
### converge
|
||||
## How to use
|
||||
|
||||
```yaml
|
||||
converge:
|
||||
@@ -115,164 +16,70 @@ converge:
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Converge
|
||||
uses: werf/actions/converge@v1.1
|
||||
with:
|
||||
env: production
|
||||
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
```
|
||||
|
||||
### build, publish and deploy
|
||||
|
||||
```yaml
|
||||
build-and-publish:
|
||||
name: Build and Publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Build and Publish
|
||||
uses: werf/actions/build-and-publish@v1.1
|
||||
with:
|
||||
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
|
||||
deploy:
|
||||
name: Deploy
|
||||
needs: build-and-publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Deploy
|
||||
uses: werf/actions/deploy@v1.1
|
||||
with:
|
||||
env: production
|
||||
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
```
|
||||
|
||||
### dismiss
|
||||
|
||||
```yaml
|
||||
dismiss:
|
||||
name: Dismiss
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Dismiss
|
||||
uses: werf/actions/dismiss@v1.1
|
||||
with:
|
||||
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
env: production
|
||||
```
|
||||
|
||||
### run
|
||||
|
||||
```yaml
|
||||
run:
|
||||
name: Run
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run
|
||||
uses: werf/actions/run@v1.1
|
||||
with:
|
||||
image: backend
|
||||
args: rails server
|
||||
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
env:
|
||||
WERF_DOCKER_OPTIONS: "-d -p 3000:3000"
|
||||
```
|
||||
|
||||
### cleanup
|
||||
|
||||
```yaml
|
||||
cleanup:
|
||||
name: Cleanup
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Fetch all history for all tags and branches
|
||||
run: git fetch --prune --unshallow
|
||||
|
||||
- name: Cleanup
|
||||
uses: werf/actions/cleanup@v1.1
|
||||
with:
|
||||
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
```
|
||||
|
||||
### install
|
||||
|
||||
```yaml
|
||||
werf:
|
||||
name: werf
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install werf CLI
|
||||
uses: werf/actions/install@v1.1
|
||||
|
||||
# for deploy and distributed locks
|
||||
- name: Create kube config
|
||||
- name: Install werf
|
||||
uses: werf/actions/install@v1.2
|
||||
|
||||
- name: Run script
|
||||
run: |
|
||||
KUBECONFIG=$(mktemp -d)/config
|
||||
base64 -d <(printf "%s" $KUBE_CONFIG_BASE64_DATA) > $KUBECONFIG
|
||||
echo KUBECONFIG=$KUBECONFIG >> $GITHUB_ENV
|
||||
. $(werf ci-env github --as-file)
|
||||
werf converge
|
||||
env:
|
||||
KUBE_CONFIG_BASE64_DATA: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
|
||||
- name: Run werf commands
|
||||
run: |
|
||||
source $(werf ci-env github --as-file)
|
||||
werf build-and-publish
|
||||
werf deploy
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
WERF_KUBECONFIG_BASE64: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
WERF_ENV: production
|
||||
```
|
||||
|
||||
# FAQ
|
||||
## Versioning
|
||||
|
||||
## werf always rebuilds images on new commit
|
||||
When using action, select the version corresponding to the required `MAJOR.MINOR` version of werf:
|
||||
|
||||
```yaml
|
||||
# Setup actual werf version within 1.1 alpha channel.
|
||||
- uses: werf/actions/install@v1.1
|
||||
|
||||
# Setup actual werf version within 1.2 alpha channel.
|
||||
- uses: werf/actions/install@v1.2
|
||||
```
|
||||
|
||||
By default, the action installs actual werf version within alpha channel (more details about channels, werf release cycle and compatibility promise [here](https://werf.io/installation.html#all-changes-in-werf-go-through-all-stability-channels)).
|
||||
Using the `channel` input 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: werf/actions/install@v1.2
|
||||
with:
|
||||
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: werf/actions/install@v1.2
|
||||
with:
|
||||
version: v1.2.9
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
### werf always rebuilds images on new commit
|
||||
|
||||
Make sure to use `fetch-depth: 0` setting in the checkout action, like follows:
|
||||
|
||||
```
|
||||
```yaml
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
```
|
||||
|
||||
By default fetch-depth set to `1` which disables git history when checking out code. werf cache selection algorithm uses git history to determine whether some image bound to some commit could be used as a cache when building current commit (current commit should be descendant to the cache commit).
|
||||
By default, fetch-depth set to `1` which disables git history when checking out code. werf cache selection algorithm uses git history to determine whether some image bound to some commit could be used as a cache when building current commit (current commit should be descendant to the cache commit).
|
||||
|
||||
Setting `fetch-depth` to `0` enables full fetch of git history and it is a **recommended** approach. It is also possible to limit fetch history with some decent number of commits, which would enable images caching limited to that number of commits, but this would have a negative impact on cache reproducibility.
|
||||
|
||||
# License
|
||||
## License
|
||||
|
||||
Apache License 2.0, see [LICENSE](LICENSE)
|
||||
|
||||
@@ -23,5 +23,5 @@ inputs:
|
||||
description: 'Base64 encoded kubeconfig data used for deployment, cleanup and distributed locks'
|
||||
required: false
|
||||
runs:
|
||||
using: 'node12'
|
||||
using: 'node20'
|
||||
main: 'converge/index.js'
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
<p align="center">
|
||||
<img src="https://github.com/werf/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 build-and-publish`.
|
||||
|
||||
## 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/werf/werf#backward-compatibility-promise)).
|
||||
Using the `channel` input 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: werf/actions/build-and-publish@v1.1
|
||||
with:
|
||||
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: werf/actions/build-and-publish@v1.1
|
||||
with:
|
||||
version: v1.1.23
|
||||
```
|
||||
|
||||
### 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: werf/actions/build-and-publish@v1.1
|
||||
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: werf/actions/build-and-publish@v1.1
|
||||
env:
|
||||
WERF_LOG_VERBOSE: "on"
|
||||
WERF_TAG_CUSTOM_TAG1: tag1
|
||||
WERF_TAG_CUSTOM_TAG2: tag2
|
||||
```
|
||||
|
||||
## Inputs
|
||||
|
||||
```yaml
|
||||
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
|
||||
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
|
||||
build-and-publish:
|
||||
name: Build and Publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Build and Publish
|
||||
uses: werf/actions/build-and-publish@v1.1
|
||||
with:
|
||||
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
```
|
||||
@@ -1,24 +0,0 @@
|
||||
name: werf build-and-publish
|
||||
author: 'Flant'
|
||||
description: 'Prepare the environment and perform image building and publishing with werf'
|
||||
branding:
|
||||
color: blue
|
||||
icon: anchor
|
||||
inputs:
|
||||
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
|
||||
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
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'index.js'
|
||||
File diff suppressed because one or more lines are too long
@@ -5,63 +5,6 @@ ___
|
||||
|
||||
The action combines all the necessary steps in itself and logic may be divided into environment setup and launching `werf build`.
|
||||
|
||||
## 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://werf.io/installation.html#all-changes-in-werf-go-through-all-stability-channels)).
|
||||
Using the `channel` input 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: werf/actions/build@v1.1
|
||||
with:
|
||||
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: werf/actions/build@v1.1
|
||||
with:
|
||||
version: v1.1.23
|
||||
```
|
||||
|
||||
### 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: werf/actions/build@v1.1
|
||||
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: werf/actions/build@v1.1
|
||||
env:
|
||||
WERF_LOG_VERBOSE: "on"
|
||||
WERF_TAG_CUSTOM_TAG1: tag1
|
||||
WERF_TAG_CUSTOM_TAG2: tag2
|
||||
```
|
||||
|
||||
## Inputs
|
||||
|
||||
```yaml
|
||||
@@ -90,12 +33,12 @@ build:
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Build
|
||||
uses: werf/actions/build@v1.1
|
||||
uses: werf/actions/build@v1.2
|
||||
with:
|
||||
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
```
|
||||
|
||||
@@ -20,5 +20,5 @@ inputs:
|
||||
description: 'Base64 encoded kubeconfig data used for deployment, cleanup and distributed locks'
|
||||
required: false
|
||||
runs:
|
||||
using: 'node12'
|
||||
using: 'node20'
|
||||
main: 'index.js'
|
||||
|
||||
23400
build/index.js
23400
build/index.js
File diff suppressed because one or more lines are too long
@@ -5,61 +5,6 @@ ___
|
||||
|
||||
The action combines all the necessary steps in itself and logic may be divided into environment setup and launching `werf cleanup`.
|
||||
|
||||
## 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://werf.io/installation.html#all-changes-in-werf-go-through-all-stability-channels)).
|
||||
Using the `channel` input 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: werf/actions/cleanup@v1.1
|
||||
with:
|
||||
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: werf/actions/cleanup@v1.1
|
||||
with:
|
||||
version: v1.1.23
|
||||
```
|
||||
|
||||
### 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: werf/actions/cleanup@v1.1
|
||||
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: werf/actions/cleanup@v1.1
|
||||
env:
|
||||
WERF_LOG_VERBOSE: "on"
|
||||
```
|
||||
|
||||
## Inputs
|
||||
|
||||
```yaml
|
||||
@@ -88,13 +33,15 @@ cleanup:
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Fetch all history for all tags and branches
|
||||
run: git fetch --prune --unshallow
|
||||
|
||||
- name: Cleanup
|
||||
uses: werf/actions/cleanup@v1.1
|
||||
uses: werf/actions/cleanup@v1.2
|
||||
with:
|
||||
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
env:
|
||||
WERF_REPO_GITHUB_TOKEN: ${{ secrets.WERF_CLEANUP_PAM }}
|
||||
```
|
||||
|
||||
@@ -20,5 +20,5 @@ inputs:
|
||||
description: 'Base64 encoded kubeconfig data used for deployment, cleanup and distributed locks'
|
||||
required: false
|
||||
runs:
|
||||
using: 'node12'
|
||||
using: 'node20'
|
||||
main: 'index.js'
|
||||
|
||||
23400
cleanup/index.js
23400
cleanup/index.js
File diff suppressed because one or more lines are too long
@@ -5,63 +5,6 @@ ___
|
||||
|
||||
The action combines all the necessary steps in itself and logic may be divided into environment setup and launching `werf converge`.
|
||||
|
||||
## 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://werf.io/installation.html#all-changes-in-werf-go-through-all-stability-channels)).
|
||||
Using the `channel` input 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: werf/actions/converge@v1.1
|
||||
with:
|
||||
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: werf/actions/converge@v1.1
|
||||
with:
|
||||
version: v1.1.23
|
||||
```
|
||||
|
||||
### 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: werf/actions/converge@v1.1
|
||||
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: werf/actions/converge@v1.1
|
||||
with:
|
||||
env: production
|
||||
env:
|
||||
WERF_LOG_VERBOSE: "on"
|
||||
```
|
||||
|
||||
## Inputs
|
||||
|
||||
```yaml
|
||||
@@ -93,12 +36,12 @@ converge:
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Converge
|
||||
uses: werf/actions/converge@v1.1
|
||||
uses: werf/actions/converge@v1.2
|
||||
with:
|
||||
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
env: production
|
||||
|
||||
@@ -12,9 +12,9 @@ inputs:
|
||||
version:
|
||||
description: 'The certain version'
|
||||
required: false
|
||||
env:
|
||||
env: # TODO: Remove this deprecated werf option, which is not required anymore (use WERF_ENV variable instead)
|
||||
description: 'Specific deployment environment'
|
||||
required: true
|
||||
required: false
|
||||
github-token:
|
||||
description: 'The GitHub token used to login and to interact with Docker Github Packages'
|
||||
default: ${{ github.token }}
|
||||
@@ -23,5 +23,5 @@ inputs:
|
||||
description: 'Base64 encoded kubeconfig data used for deployment, cleanup and distributed locks'
|
||||
required: false
|
||||
runs:
|
||||
using: 'node12'
|
||||
using: 'node20'
|
||||
main: 'index.js'
|
||||
|
||||
23400
converge/index.js
23400
converge/index.js
File diff suppressed because one or more lines are too long
105
deploy/README.md
105
deploy/README.md
@@ -1,105 +0,0 @@
|
||||
<p align="center">
|
||||
<img src="https://github.com/werf/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 deploy`.
|
||||
|
||||
## 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/werf/werf#backward-compatibility-promise)).
|
||||
Using the `channel` input 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: werf/actions/deploy@v1.1
|
||||
with:
|
||||
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: werf/actions/deploy@v1.1
|
||||
with:
|
||||
version: v1.1.23
|
||||
```
|
||||
|
||||
### 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: werf/actions/deploy@v1.1
|
||||
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: werf/actions/deploy@v1.1
|
||||
with:
|
||||
env: production
|
||||
env:
|
||||
WERF_LOG_VERBOSE: "on"
|
||||
```
|
||||
|
||||
## Inputs
|
||||
|
||||
```yaml
|
||||
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
|
||||
env:
|
||||
description: 'Specific deployment environment'
|
||||
required: true
|
||||
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
|
||||
deploy:
|
||||
name: Deploy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Deploy
|
||||
uses: werf/actions/deploy@v1.1
|
||||
with:
|
||||
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
env: production
|
||||
```
|
||||
@@ -1,27 +0,0 @@
|
||||
name: werf build-and-publish
|
||||
author: 'Flant'
|
||||
description: 'Prepare the environment and perform deployment with werf'
|
||||
branding:
|
||||
color: blue
|
||||
icon: anchor
|
||||
inputs:
|
||||
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
|
||||
env:
|
||||
description: 'Specific deployment environment'
|
||||
required: true
|
||||
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
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'index.js'
|
||||
30419
deploy/index.js
30419
deploy/index.js
File diff suppressed because one or more lines are too long
@@ -5,63 +5,6 @@ ___
|
||||
|
||||
The action combines all the necessary steps in itself and logic may be divided into environment setup and launching `werf dismiss`.
|
||||
|
||||
## 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://werf.io/installation.html#all-changes-in-werf-go-through-all-stability-channels)).
|
||||
Using the `channel` input 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: werf/actions/converge@v1.1
|
||||
with:
|
||||
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: werf/actions/converge@v1.1
|
||||
with:
|
||||
version: v1.1.23
|
||||
```
|
||||
|
||||
### 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: werf/actions/converge@v1.1
|
||||
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: werf/actions/converge@v1.1
|
||||
with:
|
||||
env: production
|
||||
env:
|
||||
WERF_LOG_VERBOSE: "on"
|
||||
```
|
||||
|
||||
## Inputs
|
||||
|
||||
```yaml
|
||||
@@ -93,10 +36,10 @@ dismiss:
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Dismiss
|
||||
uses: werf/actions/dismiss@v1.1
|
||||
uses: werf/actions/dismiss@v1.2
|
||||
with:
|
||||
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
env: production
|
||||
|
||||
@@ -12,9 +12,9 @@ inputs:
|
||||
version:
|
||||
description: 'The certain version'
|
||||
required: false
|
||||
env:
|
||||
env: # TODO: Remove this deprecated werf option, which is not required anymore (use WERF_ENV variable instead)
|
||||
description: 'Specific deployment environment'
|
||||
required: true
|
||||
required: false
|
||||
github-token:
|
||||
description: 'The GitHub token used to login and to interact with Docker Github Packages'
|
||||
default: ${{ github.token }}
|
||||
@@ -23,5 +23,5 @@ inputs:
|
||||
description: 'Base64 encoded kubeconfig data used for deployment, cleanup and distributed locks'
|
||||
required: false
|
||||
runs:
|
||||
using: 'node12'
|
||||
using: 'node20'
|
||||
main: 'index.js'
|
||||
|
||||
23400
dismiss/index.js
23400
dismiss/index.js
File diff suppressed because one or more lines are too long
@@ -3,13 +3,13 @@
|
||||
</p>
|
||||
___
|
||||
|
||||
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://werf.io/installation.html#all-changes-in-werf-go-through-all-stability-channels)).
|
||||
By default, all actions setup actual werf version for 1.2 alpha channel (more details about channels, werf release cycle and compatibility promise [here](https://werf.io/installation.html#all-changes-in-werf-go-through-all-stability-channels)).
|
||||
Using the `channel` input 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: werf/actions/install@v1.1
|
||||
- uses: werf/actions/install@v1.2
|
||||
with:
|
||||
channel: alpha
|
||||
```
|
||||
@@ -17,9 +17,9 @@ Using the `channel` input the user can switch the release channel.
|
||||
Withal, it is not necessary to work within release channels, and the user might specify certain werf version with `version` input.
|
||||
|
||||
```yaml
|
||||
- uses: werf/actions/install@v1.1
|
||||
- uses: werf/actions/install@v1.2
|
||||
with:
|
||||
version: v1.1.23
|
||||
version: v1.2.9
|
||||
```
|
||||
|
||||
## Inputs
|
||||
@@ -43,12 +43,12 @@ werf:
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install werf CLI
|
||||
uses: werf/actions/install@v1.1
|
||||
uses: werf/actions/install@v1.2
|
||||
|
||||
# for deploy and distributed locks
|
||||
# For deploy and distributed locks.
|
||||
- name: Create kube config
|
||||
run: |
|
||||
KUBECONFIG=$(mktemp -d)/config
|
||||
@@ -60,8 +60,8 @@ werf:
|
||||
- name: Run werf commands
|
||||
run: |
|
||||
source $(werf ci-env github --as-file)
|
||||
werf build-and-publish
|
||||
werf deploy
|
||||
werf render
|
||||
werf converge
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
WERF_ENV: production
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: Install werf CLI
|
||||
author: 'Flant'
|
||||
description: 'Install actual channel werf version, like multiwerf does, or specified one'
|
||||
description: 'Install werf CLI'
|
||||
branding:
|
||||
color: blue
|
||||
icon: anchor
|
||||
@@ -17,5 +17,5 @@ inputs:
|
||||
default: '0'
|
||||
required: false
|
||||
runs:
|
||||
using: 'node12'
|
||||
using: 'node20'
|
||||
main: 'index.js'
|
||||
|
||||
23402
install/index.js
23402
install/index.js
File diff suppressed because one or more lines are too long
2
pack.sh
2
pack.sh
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
for pkg in build build-and-publish cleanup converge deploy dismiss install publish run; do ncc build src/$pkg.ts -o $pkg; done
|
||||
for pkg in build cleanup converge dismiss install run; do ncc build src/$pkg.ts -o $pkg; done
|
||||
|
||||
3707
package-lock.json
generated
3707
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "werf-actions",
|
||||
"version": "1.1.1",
|
||||
"version": "1.2.1",
|
||||
"description": "",
|
||||
"main": "lib",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.6.0",
|
||||
"@actions/core": "^1.9.1",
|
||||
"@actions/github": "^5.0.0",
|
||||
"@actions/tool-cache": "^1.7.1",
|
||||
"dotenv": "10.0.x",
|
||||
"semver": "^7.3.5",
|
||||
"semver": "^7.5.2",
|
||||
"string-argv": "^0.3.1",
|
||||
"superagent": "^6.1.0",
|
||||
"tmp": "^0.2.1",
|
||||
@@ -25,7 +25,7 @@
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-github": "^4.3.2",
|
||||
"js-yaml": "^3.13.1",
|
||||
"node-fetch": ">=2.6.1",
|
||||
"node-fetch": ">=3.2.10",
|
||||
"prettier": "^1.19.1",
|
||||
"typescript": "^3.6.4"
|
||||
},
|
||||
@@ -34,7 +34,7 @@
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"lint": "eslint src/**/*.ts",
|
||||
"pack": "pack.sh",
|
||||
"pack": "./pack.sh",
|
||||
"all": "npm run build && npm run format && npm run lint && npm run pack"
|
||||
},
|
||||
"repository": {
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
<p align="center">
|
||||
<img src="https://github.com/werf/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 publish`.
|
||||
|
||||
## 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/werf/werf#backward-compatibility-promise)).
|
||||
Using the `channel` input 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: werf/actions/publish@v1.1
|
||||
with:
|
||||
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: werf/actions/publish@v1.1
|
||||
with:
|
||||
version: v1.1.23
|
||||
```
|
||||
|
||||
### 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: werf/actions/publish@v1.1
|
||||
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: werf/actions/publish@v1.1
|
||||
env:
|
||||
WERF_LOG_VERBOSE: "on"
|
||||
WERF_TAG_CUSTOM_TAG1: tag1
|
||||
WERF_TAG_CUSTOM_TAG2: tag2
|
||||
```
|
||||
|
||||
## Inputs
|
||||
|
||||
```yaml
|
||||
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
|
||||
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
|
||||
publish:
|
||||
name: Publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Publish
|
||||
uses: werf/actions/publish@v1.1
|
||||
with:
|
||||
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
|
||||
```
|
||||
@@ -1,24 +0,0 @@
|
||||
name: werf publish
|
||||
author: 'Flant'
|
||||
description: 'Prepare the environment and perform image publishing with werf'
|
||||
branding:
|
||||
color: blue
|
||||
icon: anchor
|
||||
inputs:
|
||||
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
|
||||
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
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'index.js'
|
||||
30418
publish/index.js
30418
publish/index.js
File diff suppressed because one or more lines are too long
@@ -5,63 +5,6 @@ ___
|
||||
|
||||
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://werf.io/installation.html#all-changes-in-werf-go-through-all-stability-channels)).
|
||||
Using the `channel` input 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: werf/actions/run@v1.1
|
||||
with:
|
||||
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: werf/actions/run@v1.1
|
||||
with:
|
||||
version: v1.1.23
|
||||
```
|
||||
|
||||
### 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: werf/actions/run@v1.1
|
||||
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: werf/actions/run@v1.1
|
||||
env:
|
||||
WERF_LOG_VERBOSE: "on"
|
||||
WERF_TAG_CUSTOM_TAG1: tag1
|
||||
WERF_TAG_CUSTOM_TAG2: tag2
|
||||
```
|
||||
|
||||
## Inputs
|
||||
|
||||
```yaml
|
||||
@@ -97,12 +40,12 @@ run:
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run
|
||||
uses: werf/actions/run@v1.1
|
||||
uses: werf/actions/run@v1.2
|
||||
with:
|
||||
image: backend
|
||||
args: rails server
|
||||
|
||||
@@ -26,5 +26,5 @@ inputs:
|
||||
description: 'Base64 encoded kubeconfig data used for deployment, cleanup and distributed locks'
|
||||
required: false
|
||||
runs:
|
||||
using: 'node12'
|
||||
using: 'node20'
|
||||
main: 'index.js'
|
||||
|
||||
23494
run/index.js
23494
run/index.js
File diff suppressed because one or more lines are too long
@@ -1,12 +0,0 @@
|
||||
import * as core from '@actions/core'
|
||||
import {PrepareEnvironAndRunWerfCommand} from './common'
|
||||
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
await PrepareEnvironAndRunWerfCommand(['build-and-publish'])
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
||||
@@ -47,13 +47,17 @@ export async function SetupKubeConfig(
|
||||
export function ProcessGitHubContext(): void {
|
||||
if (context.eventName === 'pull_request') {
|
||||
if (context.payload.pull_request) {
|
||||
// Do nothing if virtual merge variable is already set
|
||||
if (process.env.WERF_VIRTUAL_MERGE) {
|
||||
return
|
||||
}
|
||||
|
||||
const baseSha = context.payload.pull_request.base.sha
|
||||
const headSha = context.payload.pull_request.head.sha
|
||||
|
||||
process.env.WERF_VIRTUAL_MERGE = '1'
|
||||
process.env.WERF_VIRTUAL_MERGE_FROM_COMMIT = headSha
|
||||
process.env.WERF_VIRTUAL_MERGE_INTO_COMMIT = baseSha
|
||||
|
||||
core.exportVariable('WERF_VIRTUAL_MERGE', '1')
|
||||
core.exportVariable('WERF_VIRTUAL_MERGE_FROM_COMMIT', headSha)
|
||||
core.exportVariable('WERF_VIRTUAL_MERGE_INTO_COMMIT', baseSha)
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import * as core from '@actions/core'
|
||||
import {PrepareEnvironAndRunWerfCommand} from './common'
|
||||
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
process.env.WERF_ENV = core.getInput('env')
|
||||
await PrepareEnvironAndRunWerfCommand(['deploy'])
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
||||
@@ -1,8 +1,11 @@
|
||||
import * as core from '@actions/core'
|
||||
import {Manager} from './manager'
|
||||
import {ProcessGitHubContext} from './common'
|
||||
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
ProcessGitHubContext()
|
||||
|
||||
const m = new Manager()
|
||||
await m.Install()
|
||||
} catch (error) {
|
||||
|
||||
@@ -83,6 +83,11 @@ export class Manager {
|
||||
const tmpFilePath = tmpFile.name
|
||||
await this.Exec(['ci-env', 'github', '--as-env-file', '-o', tmpFilePath])
|
||||
const res = dotenv.config({path: tmpFilePath})
|
||||
if (res.parsed) {
|
||||
for (const [key, value] of Object.entries(res.parsed)) {
|
||||
core.exportVariable(key, value)
|
||||
}
|
||||
}
|
||||
console.log(res.parsed)
|
||||
tmpFile.removeCallback()
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import * as core from '@actions/core'
|
||||
import {PrepareEnvironAndRunWerfCommand} from './common'
|
||||
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
await PrepareEnvironAndRunWerfCommand(['publish'])
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
||||
@@ -1,3 +1,3 @@
|
||||
export const MAJOR_MINOR_GROUP = '1.1'
|
||||
export const MAJOR_MINOR_GROUP = '1.2'
|
||||
export const MAJOR = 1
|
||||
export const MINOR = 1
|
||||
export const MINOR = 2
|
||||
|
||||
Reference in New Issue
Block a user