This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 111
133 lines (129 loc) · 4.98 KB
/
release.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#
# Copyright (c) 2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
name: Release Che Theia
on:
workflow_dispatch:
inputs:
version:
description: 'The version that is going to be released. Should be in format 7.y.z'
required: true
default: ''
forceRecreateTags:
description: If true, tags will be recreated. Use with caution
required: false
default: 'false'
pushToNpmJs:
description: If true, will push packages to npmjs
required: false
default: 'true'
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
name: Checkout che-theia source code
with:
fetch-depth: 0
- name: Check existing tags
run: |
set +e
RECREATE_TAGS=${{ github.event.inputs.forceRecreateTags }}
VERSION=${{ github.event.inputs.version }}
EXISTING_TAG=$(git ls-remote --exit-code origin refs/tags/${VERSION})
if [[ -n ${EXISTING_TAG} ]]; then
if [[ ${RECREATE_TAGS} == "true" ]]; then
echo "[INFO] Removing tag for ${VERSION} version. New tag will be recreated during release."
git push origin :$VERSION
else
echo "[ERROR] Cannot proceed with release - tag ${EXISTING_TAG} already exists."
exit 1
fi
else
echo "[INFO] No existing tags detected for $VERSION"
fi
- uses: actions/setup-node@v1
name: Configuring nodejs 14.x version
with:
node-version: '14.x'
- name: Login to docker.io
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
registry: docker.io
- name: Login to quay.io
uses: docker/login-action@v1
with:
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
registry: quay.io
- name: Prepare release
run: |
git config --global user.name "Mykhailo Kuznietsov"
git config --global user.email "[email protected]"
export GITHUB_TOKEN=${{ secrets.CHE_BOT_GITHUB_TOKEN }}
export AKAMAI_CHE_AUTH=${{ secrets.AKAMAI_CHE_AUTH }}
./make-release.sh --version ${{ github.event.inputs.version }}
- name: Build and publish images
run: |
docker image prune -a -f
./build.sh --root-yarn-opts:--ignore-scripts --dockerfile:Dockerfile.alpine --push
env:
CDN_PREFIX: https://static.developers.redhat.com/che/theia_artifacts/
MONACO_CDN_PREFIX: https://cdn.jsdelivr.net/npm/
- name: Set-up npmjs auth token
if: github.event.inputs.pushToNpmJs == true
run: printf "//registry.npmjs.org/:_authToken=${{ secrets.CHE_NPM_AUTH_TOKEN }}\n" >> ~/.npmrc
- name: Publish packages to npmjs
if: github.event.inputs.pushToNpmJs == true
run: yarn publish:next
notify:
runs-on: ubuntu-20.04
needs: build
if: always() && ((needs.build.result == 'failure') || (needs.build.result == 'success'))
steps:
- name: Create failure MM message
if: ${{ needs.build.result == 'failure' }}
run: |
echo "{\"text\":\":no_entry_sign: Che Theia ${{ github.event.inputs.version }} release has failed: https://github.com/eclipse-che/che-theia/actions/workflows/release.yml\"}" > mattermost.json
- name: Create success MM message
if: ${{ needs.build.result == 'success' }}
run: |
echo "{\"text\":\":white_check_mark: Che Theia ${{ github.event.inputs.version }} has been released: https://quay.io/eclipse/che-theia-dev:${{ github.event.inputs.version }} https://quay.io/eclipse/che-theia:${{ github.event.inputs.version }} https://quay.io/eclipse/che-theia-endpoint-runtime-binary:${{ github.event.inputs.version }}\"}" > mattermost.json
- name: Send MM message
uses: mattermost/[email protected]
env:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_CHANNEL: eclipse-che-releases
MATTERMOST_USERNAME: che-bot
# TODO: uncomment this when we're happy that travis is working for PRs
# travis-release:
# needs: build
# runs-on: ubuntu-latest
# continue-on-error: true
# steps:
# - name: Trigger build on Travis CI
# run: |
# body="{
# \"request\":{
# \"config\": {
# \"env\": {
# \"global\": [
# \"TAG=${{ github.event.inputs.version }}\"
# ]
# }
# }
# }}"
# curl -s -X POST \
# -H "Content-Type: application/json" \
# -H "Accept: application/json" \
# -H "Travis-API-Version: 3" \
# -H "Authorization: token ${{ secrets.TRAVIS_TOKEN }}" \
# -d "$body" \
# https://api.travis-ci.com/repo/eclipse-che%2Fche-theia/requests