49 Commits

Author SHA1 Message Date
Alexey Igrychev
e5e6d49cdd Merge pull request #54 from werf/chore_readme_fix_links
chore(readme): fix links
2022-08-15 08:03:57 +01:00
Alexey Igrychev
124534d1bb chore(readme): fix links
Signed-off-by: Alexey Igrychev <alexey.igrychev@flant.com>
2022-08-15 08:03:16 +01:00
Alexey Igrychev
5b66dc4131 Merge pull request #52 from werf/dependabot/npm_and_yarn/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6
2022-08-15 07:58:12 +01:00
Alexey Igrychev
ed5a3d1e9b chore: update install action description
Signed-off-by: Alexey Igrychev <alexey.igrychev@flant.com>
2022-07-06 15:39:16 +01:00
dependabot[bot]
3729ed90a5 Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 18:57:31 +00:00
Alexey Igrychev
e1fbd124d8 Merge pull request #50 from werf/dependabot/npm_and_yarn/node-fetch-3.1.1
Bump node-fetch from 2.6.5 to 3.1.1
2022-02-21 13:06:07 +00:00
dependabot[bot]
0617fd4cf8 Bump node-fetch from 2.6.5 to 3.1.1
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.5 to 3.1.1.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.5...v3.1.1)

---
updated-dependencies:
- dependency-name: node-fetch
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-22 12:18:24 +00:00
Alexey Igrychev
c05acfa9d8 Merge pull request #49 from werf/fix-dismiss-action
fix: converge and dismiss actions should not require env param
2021-12-17 13:26:27 +00:00
Timofey Kirillov
5b9769fd62 chore: npm repack 2021-12-17 13:37:08 +03:00
Timofey Kirillov
6545aa68e3 fix: converge and dismiss actions should not require env param 2021-12-17 13:23:54 +03:00
Alexey Igrychev
bd2180a34d Merge pull request #48 from werf/chore_readme_fix_werf_logo
chore(readme): fix failed to load werf logo
2021-12-07 15:17:07 +00:00
Alexey Igrychev
efd32e8190 chore(readme): fix failed to load werf logo 2021-12-07 16:16:52 +01:00
Alexey Igrychev
0fed75c13c Merge pull request #46 from werf/docs_fix_werf_logo_in_readme
docs: fix werf logo in README.md
2021-11-10 13:27:47 +00:00
Alexey Igrychev
5aa19beb9e docs: fix werf logo in README.md 2021-11-10 14:27:35 +01:00
Alexey Igrychev
84fc1961b2 Merge pull request #44 from werf/feat_use_trdl_binaries
feat: download binaries directly from the trdl repository
2021-10-28 12:24:38 +01:00
Alexey Igrychev
8f92bdfbf0 feat: download binaries directly from the trdl repository 2021-10-27 22:11:56 +01:00
Alexey Igrychev
c8d9dcbd53 ci(test): add Test workflow 2021-10-27 21:57:05 +01:00
Alexey Igrychev
6f7411b1c0 build: update dependencies and lint configuration 2021-10-25 15:49:36 +01:00
Alexey Igrychev
00a90c715d Merge pull request #39 from werf/chore_update_readme
chore(docs): update README.md
2021-08-17 01:12:03 +02:00
Alexey Igrychev
cae57c1fe2 chore(docs): update README.md 2021-08-17 01:10:33 +02:00
Alexey Igrychev
5201be8745 Merge pull request #38 from werf/dependabot/npm_and_yarn/path-parse-1.0.7
Bump path-parse from 1.0.6 to 1.0.7
2021-08-16 10:47:46 +02:00
dependabot[bot]
86a1f64ff2 Bump path-parse from 1.0.6 to 1.0.7
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-12 12:09:04 +00:00
Alexey Igrychev
d498415460 Merge pull request #37 from werf/alexey-igrychev-patch-1
chore(readme): tiny fix
2021-08-06 19:35:41 +02:00
Alexey Igrychev
850bbb65ad chore(readme): tiny fix 2021-08-06 19:35:29 +02:00
Alexey Igrychev
a73b4d34fd Merge pull request #36 from werf/alexey-igrychev-patch-1
chore(readme): fix typo
2021-08-06 17:10:55 +02:00
Alexey Igrychev
3dbf8c10c0 chore(readme): fix typo 2021-08-06 17:10:39 +02:00
Alexey Igrychev
01d8c1ceea Merge pull request #35 from werf/chore_readme_update_versions
chore(readme): update according to the latest versions
2021-08-06 16:42:28 +02:00
Alexey Igrychev
b7ed64f2df chore(readme): update according to the latest versions 2021-08-06 15:19:17 +02:00
Alexey Igrychev
2b23b0c4ff Merge pull request #32 from werf/dependabot/npm_and_yarn/ws-7.4.6
Bump ws from 7.3.1 to 7.4.6
2021-08-04 22:42:54 +02:00
Alexey Igrychev
283070759b Merge pull request #33 from werf/dependabot/npm_and_yarn/glob-parent-5.1.2
Bump glob-parent from 5.1.1 to 5.1.2
2021-08-04 22:42:46 +02:00
dependabot[bot]
56a4bc82d3 Bump glob-parent from 5.1.1 to 5.1.2
Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-12 04:12:57 +00:00
dependabot[bot]
7c46a8aac9 Bump ws from 7.3.1 to 7.4.6
Bumps [ws](https://github.com/websockets/ws) from 7.3.1 to 7.4.6.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.3.1...7.4.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-30 11:41:28 +00:00
Alexey Igrychev
3e6d892594 Merge pull request #31 from werf/dependabot/npm_and_yarn/hosted-git-info-2.8.9
Bump hosted-git-info from 2.8.8 to 2.8.9
2021-05-12 09:40:44 +01:00
Alexey Igrychev
b03f6749c6 Merge pull request #30 from werf/dependabot/npm_and_yarn/lodash-4.17.21
Bump lodash from 4.17.19 to 4.17.21
2021-05-12 09:40:26 +01:00
dependabot[bot]
2ce1908426 Bump hosted-git-info from 2.8.8 to 2.8.9
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-11 18:43:43 +00:00
dependabot[bot]
3869de4804 Bump lodash from 4.17.19 to 4.17.21
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-11 15:31:26 +00:00
Alexey Igrychev
b2e09d839f Merge pull request #29 from werf/output_dotenv_instead_of_catting_source_file
Output envs loaded by the dotenv instead of printing a source file content
2021-03-18 16:14:43 -01:00
Alexey Igrychev
23596d318c Output envs loaded by the dotenv instead of printing a source file content 2021-03-18 17:12:32 +00:00
Alexey Igrychev
1802a119b1 Merge pull request #27 from werf/readme_update_links
[readme] Update links to werf documentation
2021-03-10 16:17:13 +00:00
Alexey Igrychev
8f134231c2 [readme] Update links to werf documentation 2021-03-10 16:16:10 +00:00
Alexey Igrychev
2bf444c364 [readme] Remove broken link 2021-03-10 16:12:57 +00:00
Alexey Igrychev
8e55e7d93d [readme] Add "Versioning" section 2021-03-10 15:47:08 +00:00
Alexey Igrychev
4d1cac7064 Merge pull request #25 from werf/readme_small_improvements
[readme] Small improvements
2021-03-10 14:55:49 +00:00
Alexey Igrychev
d8c14de78e [readme] Add "Working with container registry" section 2021-03-10 14:53:46 +00:00
Alexey Igrychev
ca52a4e8ec [readme] Update channels, werf release cycle and compatibility promise link 2021-03-10 14:37:41 +00:00
Alexey Igrychev
6e29948fe2 Merge pull request #24 from werf/readme_default_version
[readme] Update default MAJOR.MINOR group and channel
2021-03-10 14:34:20 +00:00
Alexey Igrychev
8037e10244 [readme] Update default MAJOR.MINOR group and channel 2021-03-10 14:33:13 +00:00
Alexey Igrychev
432a3754b4 Merge pull request #23 from werf/v1.2_actions
Actions for v1.2 werf versions
2021-03-10 14:24:58 +00:00
Alexey Igrychev
2df7b68580 Actions for v1.2 werf version
- remove actions not used in v1.2
- update the example arbitrary version
- embed v1.2 MAJOR.MINOR
2021-03-10 14:21:40 +00:00
35 changed files with 156703 additions and 373668 deletions

View File

@@ -1,6 +1,6 @@
{
"plugins": ["@typescript-eslint"],
"extends": ["plugin:github/es6"],
"plugins": ["@typescript-eslint", "github"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended","plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
@@ -13,43 +13,10 @@
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-ignore": "error",
"camelcase": "off",
"@typescript-eslint/camelcase": "error",
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/generic-type-naming": ["error", "^[A-Z][A-Za-z]*$"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-object-literal-type-assertion": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-interface": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
"i18n-text/no-en": "off",
"sort-imports": "off"
},
"env": {
"node": true,

43
.github/workflows/test.yaml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: Test
on:
push:
jobs:
channel:
name: By channel
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install
uses: ./install
- run: werf version
version:
name: By version
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install
uses: ./install
with:
version: v1.2.35
- run: werf version

164
README.md
View File

@@ -1,36 +1,45 @@
<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">
<img src="https://werf.io/assets/images/werf-logo.svg?sanitize=true" style="max-height:100%;" height="175">
</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:
- [werf/actions/converge](https://github.com/werf/actions/tree/master/converge)
- [werf/actions/build-and-publish](https://github.com/werf/actions/tree/master/build-and-publish)
- [werf/actions/build](https://github.com/werf/actions/tree/master/build)
- [werf/actions/publish](https://github.com/werf/actions/tree/master/build)
- [werf/actions/deploy](https://github.com/werf/actions/tree/master/deploy)
- [werf/actions/dismiss](https://github.com/werf/actions/tree/master/dismiss)
- [werf/actions/run](https://github.com/werf/actions/tree/master/run)
- [werf/actions/cleanup](https://github.com/werf/actions/tree/master/cleanup)
- [werf/actions/converge](https://github.com/werf/actions/tree/v1.2/converge)
- [werf/actions/dismiss](https://github.com/werf/actions/tree/v1.2/dismiss)
- [werf/actions/build](https://github.com/werf/actions/tree/v1.2/build)
- [werf/actions/run](https://github.com/werf/actions/tree/v1.2/run)
- [werf/actions/cleanup](https://github.com/werf/actions/tree/v1.2/cleanup)
Each action combines all the necessary steps in itself and logic may be divided into environment setup and launching the corresponding command.
Each action combines all the necessary steps in itself, and logic may be divided into [environment setup](#environment-setup-in-details) and launching the corresponding command.
**Ready-to-use GitHub Actions Workflows** for different CI/CD workflows are available [here](https://werf.io/documentation/advanced/ci_cd/github_actions.html#complete-set-of-configurations-for-ready-made-workflows).
**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).
> Also, there is another action — [werf/actions/install](https://github.com/werf/actions/tree/master/install). With this action a user can just install werf and use binary within job steps for own purposes
> Also, there is another action — [werf/actions/install](https://github.com/werf/actions/tree/v1.2/install). With this action, the user can install werf and use binary within job steps for own purposes.
## Versioning
When using actions, select the version corresponding to the required `MAJOR.MINOR` version of werf:
```yaml
# Run converge using actual werf version within 1.1 alpha channel.
- uses: werf/actions/converge@v1.1
# Run converge using actual werf version within 1.2 alpha channel.
- uses: werf/actions/converge@v1.2
```
## Environment setup in details
### werf binary setup
### werf binary installation
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)).
By default, all actions install actual werf version within 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
> 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
- uses: werf/actions/converge@v1.2
with:
channel: alpha
```
@@ -38,45 +47,80 @@ 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/converge@v1.1
- uses: werf/actions/converge@v1.2
with:
version: v1.1.23
version: v1.2.9
```
### werf ci-env
This is the step where an action:
- sets the defaults for werf command options based on [GitHub Workflow environment variables](https://docs.github.com/en/actions/reference/environment-variables) (e.g. container repository address to the `WERF_REPO` environment variable using the following pattern: `ghcr.io/$GITHUB_REPOSITORY/<project-from-werf.yaml>`).
- performs _docker login_ to `ghcr.io` using the `github-token` input (only if `ghcr.io` used as `WERF_REPO`).
> The `github-token` input is optional, and the input is there in case you need to use a non-default token. By default, an action will use [the token provided to your workflow](https://docs.github.com/en/actions/reference/authentication-in-a-workflow#about-the-github_token-secret).
### 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`).
* Prepare _kubeconfig_ (e.g. `cat ~/.kube/config | base64`) and save in [GitHub Secrets](https://docs.github.com/en/actions/reference/encrypted-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
- uses: werf/actions/converge@v1.2
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:
All werf options can be defined with environment variables:
```yaml
- uses: werf/actions/build-and-publish@v1.1
- uses: werf/actions/converge@v1.2
env:
WERF_LOG_VERBOSE: "on"
WERF_TAG_CUSTOM_TAG1: tag1
WERF_TAG_CUSTOM_TAG2: tag2
WERF_LOG_VERBOSE: "on" # The same as using the option --log-verbose=on.
```
## Working with container registry
### Default container repository
An action generates the default container repository address and performs _docker login_ to the registry within [werf ci-env step](#werf-ci-env).
For cleanup action, the user needs [to create personal access token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) with `read:packages` and `delete:packages` scope and uses it as the `WERF_REPO_GITHUB_TOKEN` environment variable or the `github-token` input. It is recommended [to store the token as a secret](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets).
```yaml
- 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 }}
```
### Custom container repository
An arbitrary container repository can be specified with the `WERF_REPO` and `WERF_REPO_CONTAINER_REGISTRY` environment variables. For instance, steps for GCR:
```yaml
- name: Login to GCR
uses: docker/login-action@v1
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}
- uses: werf/actions/converge@v1.2
env:
WERF_REPO: "gcr.io/company/app"
WERF_REPO_CONTAINER_REGISTRY: "gcr"
```
> To learn more about how to work with the different container registries, see the appropriate [article in the werf documentation](https://werf.io/documentation/v1.2/advanced/supported_container_registries.html).
## Examples
### converge
@@ -93,43 +137,7 @@ converge:
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
uses: werf/actions/converge@v1.2
with:
env: production
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
@@ -147,7 +155,7 @@ dismiss:
uses: actions/checkout@v2
- 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
@@ -167,7 +175,7 @@ run:
fetch-depth: 0
- name: Run
uses: werf/actions/run@v1.1
uses: werf/actions/run@v1.2
with:
image: backend
args: rails server
@@ -191,9 +199,11 @@ cleanup:
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 }}
```
### install
@@ -208,9 +218,9 @@ werf:
uses: actions/checkout@v2
- 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
@@ -222,8 +232,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

View File

@@ -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 }}
```

View File

@@ -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

View File

@@ -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://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@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
@@ -95,7 +38,7 @@ build:
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 }}
```

File diff suppressed because one or more lines are too long

View File

@@ -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://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/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
@@ -94,7 +39,9 @@ cleanup:
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 }}
```

File diff suppressed because one or more lines are too long

View File

@@ -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://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/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
@@ -98,7 +41,7 @@ converge:
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

View File

@@ -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 }}

File diff suppressed because one or more lines are too long

View File

@@ -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
```

View File

@@ -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'

File diff suppressed because one or more lines are too long

View File

@@ -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://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/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
@@ -96,7 +39,7 @@ dismiss:
uses: actions/checkout@v2
- 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

View File

@@ -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 }}

File diff suppressed because one or more lines are too long

View File

@@ -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://github.com/werf/werf#backward-compatibility-promise)).
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
@@ -46,9 +46,9 @@ werf:
uses: actions/checkout@v2
- 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

View File

@@ -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

File diff suppressed because one or more lines are too long

View File

@@ -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

7530
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,31 +1,31 @@
{
"name": "werf-actions",
"version": "1.1.0",
"version": "1.2.1",
"description": "",
"main": "lib",
"dependencies": {
"@actions/core": "^1.2.6",
"@actions/github": "2.x",
"@actions/tool-cache": "1.x",
"dotenv": "8.2.x",
"ncc": "^0.3.6",
"semver": "^7.3.2",
"@actions/core": "^1.6.0",
"@actions/github": "^5.0.0",
"@actions/tool-cache": "^1.7.1",
"dotenv": "10.0.x",
"semver": "^7.3.5",
"string-argv": "^0.3.1",
"superagent": "^3.8.3",
"superagent": "^6.1.0",
"tmp": "^0.2.1",
"typescript-string-operations": "^1.4.0",
"ws": ">=3.3.1"
"ws": ">=8.2.3"
},
"devDependencies": {
"@types/node": "^12.19.1",
"@types/semver": "^7.3.4",
"@types/superagent": "^4.1.10",
"@types/tmp": "^0.2.0",
"@typescript-eslint/parser": "^2.8.0",
"eslint": "^5.x",
"eslint-plugin-github": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0",
"eslint-plugin-github": "^4.3.2",
"js-yaml": "^3.13.1",
"node-fetch": ">=2.6.1",
"node-fetch": ">=3.1.1",
"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": {

View File

@@ -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 }}
```

View File

@@ -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'

File diff suppressed because one or more lines are too long

View File

@@ -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://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/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
@@ -102,7 +45,7 @@ run:
fetch-depth: 0
- name: Run
uses: werf/actions/run@v1.1
uses: werf/actions/run@v1.2
with:
image: backend
args: rails server

64561
run/index.js

File diff suppressed because one or more lines are too long

View File

@@ -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()

View File

@@ -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()

View File

@@ -12,9 +12,9 @@ import * as dotenv from 'dotenv'
import * as werf from './werf'
import {ValidateWerfVersion} from './common'
const WERF_API_GET_CHANNEL_VERSION_URL_METHOD =
'https://werf.io/api/getChannelVersionURL'
const WERF_API_GET_VERSION_URL_METHOD = 'https://werf.io/api/getVersionURL'
const WERF_TUF_SERVER_URL = 'https://tuf.werf.io'
const CACHE_TOOL_NAME = 'werf'
const CACHE_TOOL_DIR = 'werf-tools'
export class Manager {
private readonly channel: string
@@ -32,24 +32,44 @@ export class Manager {
ValidateWerfVersion(this.version)
}
if (process.platform.toString() === 'win32') {
this.os = 'windows'
} else {
this.os = process.platform.toString()
const platform = process.platform.toString()
switch (platform) {
case 'linux':
case 'darwin':
this.os = platform
break
case 'win32':
this.os = 'windows'
break
default:
throw new Error(String.Format(`The platform ${platform} not supported`))
}
this.arch = process.arch
const arch = process.arch
switch (arch) {
case 'x64':
this.arch = 'amd64'
break
case 'arm64':
this.arch = 'arm64'
break
default:
throw new Error(String.Format(`The architecture ${arch} not supported`))
}
}
public async Install(): Promise<void> {
const actualBinaryUrl = await this._getActualBinaryUrl()
const binaryName = actualBinaryUrl.substring(
actualBinaryUrl.lastIndexOf('/') + 1
)
const cachedPath = cache.find(
'werf',
CACHE_TOOL_NAME,
Manager._toolVersionCacheID(actualBinaryUrl)
)
if (cachedPath) {
this.binaryPath = path.join(cachedPath, 'werf')
this.binaryPath = path.join(cachedPath, binaryName)
} else {
this.binaryPath = await this._downloadAndCache(actualBinaryUrl)
}
@@ -62,16 +82,8 @@ export class Manager {
const tmpFile = tmp.fileSync()
const tmpFilePath = tmpFile.name
await this.Exec(['ci-env', 'github', '--as-env-file', '-o', tmpFilePath])
dotenv.config({path: tmpFilePath})
fs.readFile(tmpFilePath, null, function(err, contents) {
if (err) {
console.error(err)
} else {
console.log(contents.toString())
}
})
const res = dotenv.config({path: tmpFilePath})
console.log(res.parsed)
tmpFile.removeCallback()
}
@@ -103,35 +115,29 @@ export class Manager {
}
private async _getActualBinaryUrl(): Promise<string> {
if (this.version !== '') {
const version = this.version.slice('v'.length)
return this._constructReleaseUrl(version)
}
const url = `${WERF_TUF_SERVER_URL}/targets/channels/${werf.MAJOR_MINOR_GROUP}/${this.channel}`
try {
let url: string
let query: {}
if (this.version !== '') {
url = WERF_API_GET_VERSION_URL_METHOD
query = {
version: this.version,
os: this.os,
arch: this.arch
}
} else {
url = WERF_API_GET_CHANNEL_VERSION_URL_METHOD
query = {
group: werf.MAJOR_MINOR_GROUP,
channel: this.channel,
os: this.os,
arch: this.arch
}
}
const resp = await request.get(url).query(query)
return resp.body.data.toString()
const resp = await request
.get(url)
.buffer(true)
.parse(request.parse['application/octet-stream'])
const version = resp.body.toString().trim()
return this._constructReleaseUrl(version)
} catch (err) {
if (err.response && err.response.error) {
let errMessage = err.response.error.message
if (err.response.text) {
errMessage = String.Format('{0}\n{1}', errMessage, err.response.text)
errMessage = String.Format(
'{0}: {1}\n{2}',
url,
errMessage,
err.response.text
)
}
throw Error(errMessage)
@@ -141,19 +147,32 @@ export class Manager {
}
}
private _constructReleaseUrl(version: string): string {
let ext = ''
if (this.os === 'windows') {
ext = '.exe'
}
return String.Format(
'{0}/targets/releases/{1}/{2}-{3}/bin/werf{4}',
WERF_TUF_SERVER_URL,
version,
this.os,
this.arch,
ext
)
}
private async _downloadAndCache(binaryUrl: string): Promise<string> {
const binaryName = binaryUrl.substring(binaryUrl.lastIndexOf('/') + 1)
const downloadedBinaryPath = await cache.downloadTool(binaryUrl)
const parsedDownloadedBinaryPath = path.parse(downloadedBinaryPath)
const cacheDownloadToolDir = parsedDownloadedBinaryPath.dir
const tmpWerfVersionBinaryPath = path.join(cacheDownloadToolDir, 'werf.tmp')
const werfVersionDir = path.join(
const cacheDownloadToolDir = path.dirname(downloadedBinaryPath)
const tmpWerfVersionBinaryPath = path.join(
cacheDownloadToolDir,
parsedDownloadedBinaryPath.name
)
const werfVersionBinaryPath = path.join(
werfVersionDir,
String.Format('werf{0}', parsedDownloadedBinaryPath.ext)
`${binaryName}.tmp`
)
const werfVersionDir = path.join(cacheDownloadToolDir, CACHE_TOOL_DIR)
const werfVersionBinaryPath = path.join(werfVersionDir, binaryName)
// werf-x.x.x -> werf.tmp
// werf.tmp -> werf-x.x.x/werf
@@ -167,7 +186,7 @@ export class Manager {
await cache.cacheDir(
werfVersionDir,
'werf',
CACHE_TOOL_NAME,
Manager._toolVersionCacheID(binaryUrl)
)

View File

@@ -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()

View File

@@ -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