forked from codefresh-io/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodefresh-release.yml
More file actions
91 lines (81 loc) · 4.11 KB
/
codefresh-release.yml
File metadata and controls
91 lines (81 loc) · 4.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# this pipeline should only be executed on master branch
version: '1.0'
steps:
fail_if_not_master:
title: "Validate running on master branch"
image: codefresh/cli-build
commands:
- 'echo This pipeline should be run only on master'
- 'exit 1'
when:
branch:
ignore: [ master ]
extract_version:
title: "Exporting package.json version"
image: codefresh/cli-build
commands:
- 'export PACKAGE_VERSION=$(jq -r ".version" package.json)'
- "echo Current version: $PACKAGE_VERSION"
- "cf_export PACKAGE_VERSION"
# in case the candidate image will not be found the release flow will crash and this means that the build pipelines has failed
push_to_registry_version:
title: "Update dockerhub image version tag"
type: push
candidate: r.cfcr.io/codefresh-inc/codefresh/cli:${{CF_SHORT_REVISION}}
image_name: codefresh/cli
tag: ${{PACKAGE_VERSION}}
registry: dockerhub
push_to_registry_latest:
title: "Update dockerhub image latest tag"
type: push
candidate: r.cfcr.io/codefresh-inc/codefresh/cli:${{CF_SHORT_REVISION}}
image_name: codefresh/cli
tag: latest
registry: dockerhub
deploy_to_npm:
title: "Publishing To Npm"
image: codefresh/npm-publish:master
commands:
- NPM_TOKEN=${{NPM_TOKEN}} npm run ci-publish
compile_executables:
title: "Compiling executables"
image: codefresh/cli-build
commands:
- "rm -rf dist"
- "yarn install"
- "yarn pkg"
create_release:
title: "Create github release"
image: codefresh/cli-build
fail_fast: false
commands:
- 'curl --fail -X POST -d ''{"tag_name":"v${{PACKAGE_VERSION}}","target_commitish":"${{CF_REVISION}}","name":"Codefresh V${{PACKAGE_VERSION}}"}'' -H "Content-Type: application/json" -H "Authorization: token ${{GITHUB_TOKEN}}" https://api.github.com/repos/codefresh-io/cli/releases'
get_release:
title: "Get github release"
image: codefresh/cli-build
commands:
- "curl --fail https://api.github.com/repos/codefresh-io/cli/releases/tags/v${{PACKAGE_VERSION}}"
- "export GITHUB_RELEASE_ID=$(curl --fail https://api.github.com/repos/codefresh-io/cli/releases/tags/v${{PACKAGE_VERSION}} | jq -r '.id')"
- "echo Github release id: $GITHUB_RELEASE_ID"
- "cf_export GITHUB_RELEASE_ID"
upload_executables:
title: "Upload executables to github release"
image: codefresh/cli-build
commands:
# delete all previous .zip/.gz created files
- "rm -rf *.gz"
- "rm -rf *.zip"
# upload linux-x64 asset
- "mv ./dist/codefresh-linux ./dist/codefresh"
- "tar -cf codefresh-v${{PACKAGE_VERSION}}-linux-x64.tar README.md LICENSE -C ./dist ./codefresh "
- "gzip codefresh-v${{PACKAGE_VERSION}}-linux-x64.tar"
- 'curl --fail -X POST -H "Content-Type:application/octet-stream" -H "Authorization: token ${{GITHUB_TOKEN}}" --data-binary @codefresh-v${{PACKAGE_VERSION}}-linux-x64.tar.gz https://uploads.github.com/repos/codefresh-io/cli/releases/${{GITHUB_RELEASE_ID}}/assets?name=codefresh-v${{PACKAGE_VERSION}}-linux-x64.tar.gz'
# upload macos-x64 asset
- "mv ./dist/codefresh-macos ./dist/codefresh"
- "tar -cf codefresh-v${{PACKAGE_VERSION}}-macos-x64.tar README.md LICENSE -C ./dist ./codefresh "
- "gzip codefresh-v${{PACKAGE_VERSION}}-macos-x64.tar"
- 'curl --fail -X POST -H "Content-Type:application/octet-stream" -H "Authorization: token ${{GITHUB_TOKEN}}" --data-binary @codefresh-v${{PACKAGE_VERSION}}-macos-x64.tar.gz https://uploads.github.com/repos/codefresh-io/cli/releases/${{GITHUB_RELEASE_ID}}/assets?name=codefresh-v${{PACKAGE_VERSION}}-macos-x64.tar.gz'
# upload win-x64 asset
- "mv ./dist/codefresh-win.exe ./dist/codefresh.exe"
- "zip codefresh-v${{PACKAGE_VERSION}}-win-x64.zip README.md LICENSE -j ./dist/codefresh.exe "
- 'curl --fail -X POST -H "Content-Type:application/octet-stream" -H "Authorization: token ${{GITHUB_TOKEN}}" --data-binary @codefresh-v${{PACKAGE_VERSION}}-win-x64.zip https://uploads.github.com/repos/codefresh-io/cli/releases/${{GITHUB_RELEASE_ID}}/assets?name=codefresh-v${{PACKAGE_VERSION}}-win-x64.zip'