-
Notifications
You must be signed in to change notification settings - Fork 36
132 lines (127 loc) · 5.05 KB
/
image-publish.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
#
# Copyright (c) 2021-2024 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: image-publish
on:
push:
branches:
- main
tags:
- '7.*.*'
jobs:
build:
name: build
strategy:
fail-fast: false
matrix:
dist: [ 'musl', 'libc-ubi8', 'libc-ubi9' ]
arch: ['amd64']
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker Build
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker buildx build --memory-swap -1 --memory 10g --platform linux/${{matrix.arch}} -f build/dockerfiles/linux-${{matrix.dist}}.Dockerfile --load -t linux-${{matrix.dist}}-${{matrix.arch}} .
- name: Upload image
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "linux-${{matrix.dist}}-${{matrix.arch}}"
assemble:
name: assemble
needs: build
runs-on: ubuntu-22.04
steps:
- name: Set variables
run: |
BRANCH_NAME=${{ github.ref }}
echo "BRANCH_NAME=${BRANCH_NAME##*/}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Download linux-libc-ubi8-amd64 image
uses: ishworkh/docker-image-artifact-download@v1
with:
image: "linux-libc-ubi8-amd64"
- name: Download linux-libc-ubi9-amd64 image
uses: ishworkh/docker-image-artifact-download@v1
with:
image: "linux-libc-ubi9-amd64"
- name: Download linux-musl image
uses: ishworkh/docker-image-artifact-download@v1
with:
image: "linux-musl-amd64"
- name: Display docker images
run: |
docker images
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Docker Build and Push
run: |
SHORT_SHA1=$(git rev-parse --short=7 HEAD)
if [[ ${{ env.BRANCH_NAME }} == main ]]; then
docker buildx build --platform linux/amd64 -f build/dockerfiles/assembly.Dockerfile --push -t quay.io/che-incubator/che-code:insiders -t quay.io/che-incubator/che-code:next -t quay.io/che-incubator/che-code:insiders-${SHORT_SHA1} .
elif [[ ${{ env.BRANCH_NAME }} =~ ^7\.[0-9]+\.[0-9]+$ ]]; then
docker buildx build --platform linux/amd64 -f build/dockerfiles/assembly.Dockerfile --push -t quay.io/che-incubator/che-code:${{ env.BRANCH_NAME }} -t quay.io/che-incubator/che-code:latest .
fi
release-finish:
name: release-finish
needs: [build, assemble]
runs-on: ubuntu-22.04
# don't notify for cancelled builds
if: (success() || failure()) && github.ref != 'refs/heads/main'
steps:
- name: Set variables
run: |
BRANCH_NAME=${{ github.ref }}
echo "BRANCH_NAME=${BRANCH_NAME##*/}" >> $GITHUB_ENV
#- name: Create failure MM message
#if: contains(join(needs.*.result, ','), 'failure')
#run: |
#echo "{\"text\":\":no_entry_sign: Che Code ${{ env.BRANCH_NAME }} release has failed: https://github.com/che-incubator/che-code/actions/workflows/image-publish.yml\"}" > mattermost.json
#- name: Create success MM message
#run: |
#echo "{\"text\":\":white_check_mark: Che Code ${{ env.BRANCH_NAME }} has been released: https://quay.io/che-incubator/che-code:${{ env.BRANCH_NAME }}\"}" > mattermost.json
#- name: Send MM message
# don't notify for cancelled builds
#if: success() || failure()
#uses: mattermost/[email protected]
#env:
#MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
#MATTERMOST_CHANNEL: eclipse-che-releases
#MATTERMOST_USERNAME: che-bot
dev:
name: dev
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Docker Build and Push
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
SHORT_SHA1=$(git rev-parse --short=7 HEAD)
docker buildx build --platform linux/amd64 -f build/dockerfiles/dev.Dockerfile --push -t quay.io/che-incubator/che-code-dev:insiders -t quay.io/che-incubator/che-code-dev:next -t quay.io/che-incubator/che-code-dev:insiders-${SHORT_SHA1} .