-
Notifications
You must be signed in to change notification settings - Fork 0
/
codefresh.yml
84 lines (81 loc) · 2.34 KB
/
codefresh.yml
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
version: "1.0"
stages:
- "clone"
- "install"
- "build"
- "push"
steps:
main_clone:
type: "git-clone"
description: "Cloning main repository..."
repo: "codefresh-io/cf-debugger"
revision: "${{CF_BRANCH}}"
stage: "clone"
install:
title: "Install Docker Image"
image: node:16.20.1
stage: "install"
shell: bash
commands:
- yarn install --frozen-lockfile --production && yarn cache clean
build:
title: "Building Docker Image"
type: "build"
image_name: "codefresh/cf-debugger"
tag: "${{CF_BRANCH_TAG_NORMALIZED}}"
dockerfile: "Dockerfile"
stage: "build"
add_git_tag:
title: "Add Git tag"
stage: "build"
image: codefreshio/ci-helpers
shell: bash
commands:
- 'export PACKAGE_VERSION=$(jq -r ".version" package.json)'
- "echo Current version: $PACKAGE_VERSION"
- "cf_export PACKAGE_VERSION"
- |-
source /get-token/get-gh-token.sh
if [[ "$(git describe --tags --abbrev=0)" == "${PACKAGE_VERSION}" ]]; then
echo "Git tag is already created, skipping..."
exit 0
fi
curl --fail -X POST -d "{\"ref\": \"refs/tags/${PACKAGE_VERSION}\", \"sha\": \"${CF_REVISION}\"}" -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/${CF_REPO_OWNER}/${CF_REPO_NAME}/git/refs
when:
branch:
only: [ master ]
parallel_push:
type: "parallel"
stage: "push"
steps:
push_to_registry_branch:
title: "Pushing image to registry with branch name"
type: push
registry: ${{REGISTRY_INTEGRATION_QUAY}}
candidate: ${{build}}
tags:
- ${{CF_BRANCH_TAG_NORMALIZED}}
push_to_registry_quay:
title: "Pushing image to quay registry"
type: "push"
registry: ${{REGISTRY_INTEGRATION_QUAY}}
candidate: ${{build}}
image_name: "codefresh/${{CF_REPO_NAME}}"
tags:
- ${{PACKAGE_VERSION}}
- latest
when:
branch:
only: [ master ]
push_to_registry_dockerhub:
title: "Pushing image to dockerhub registry"
type: "push"
registry: "dockerhub"
candidate: ${{build}}
image_name: "codefresh/${{CF_REPO_NAME}}"
tags:
- ${{PACKAGE_VERSION}}
- latest
when:
branch:
only: [ master ]