-
Notifications
You must be signed in to change notification settings - Fork 30
68 lines (63 loc) · 2.55 KB
/
build.yaml
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
name: Build Image
on:
push:
branches:
- master
- "release-**"
tags:
- v**
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Docker meta for kubesphere
id: meta
uses: docker/metadata-action@v3
with:
images: |
kubespheredev/ks-jenkins
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
- name: Cache
uses: actions/[email protected]
with:
path: ~/.m2
key: maven
restore-keys: maven
- name: Dependency
run: |
wget https://github.com/kubesphere/ks-jenkins/releases/download/v3.3.0-2.319.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2
ls -ahl
# v2.0-alpha-6 is a pre-release, jcli is not able to download it automatically.
mkdir -p ~/.jenkins-cli
curl https://github.com/LinuxSuRen/custom-war-packager/releases/download/v2.0-alpha-6/custom-war-packager-cli-2.0-alpha-7-20210527.031403-1-jar-with-dependencies.jar \
-L --output ~/.jenkins-cli/cwp-cli.jar
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build env
id: build_env
shell: bash
run: |
echo "::set-output name=version::${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}"
- name: Build
run: |
docker login --username ${{ secrets.DOCKER_HUB_USER }} --password ${{secrets.DOCKER_HUB_TOKEN}}
curl -L https://github.com/jenkins-zh/jenkins-cli/releases/latest/download/jcli-linux-amd64.tar.gz|tar xzv
export PATH=.:$PATH:phantomjs/bin
jcli cwp --install-artifacts --config-path formula.yaml --value-set output=push \
--value-set tag=kubespheredev/ks-jenkins:v${{ steps.build_env.outputs.version }} \
--value-set platform=linux/amd64,linux/arm64
- name: Push Image ghcr.io
run: |
export PATH=.:$PATH:phantomjs/bin
docker login ghcr.io --username ${{ secrets.GH_USER }} --password ${{secrets.GH_TOKEN}}
jcli cwp --install-artifacts --config-path formula.yaml --value-set output=push \
--value-set tag=ghcr.io/kubesphere/ks-jenkins:v${{ steps.build_env.outputs.version }} \
--value-set platform=linux/amd64,linux/arm64