This repository has been archived by the owner on Mar 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
88 lines (79 loc) · 3.28 KB
/
gha.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
name: pmemkv-java
on:
push:
pull_request:
release:
types:
- created
env:
REPO: pmemkv-java
GITHUB_REPO: pmem/pmemkv-java
CONTAINER_REG: ghcr.io/pmem/pmemkv-java
HOST_WORKDIR: ${{ github.workspace }}
WORKDIR: utils/docker
IMG_VER: latest
jobs:
linux:
name: Linux
runs-on: ubuntu-latest
env:
# use org's Private Access Token to log in to GitHub Container Registry
CONTAINER_REG_USER: ${{ secrets.GH_CR_USER }}
CONTAINER_REG_PASS: ${{ secrets.GH_CR_PAT }}
FORCE_IMAGE_ACTION: ${{ secrets.FORCE_IMAGE_ACTION }}
TYPE: normal
strategy:
matrix:
CONFIG: ["OS=ubuntu OS_VER=20.04 PMEMKV=master PUSH_IMAGE=1",
"OS=ubuntu OS_VER=20.04 PMEMKV=stable-1.4",
"OS=ubuntu OS_VER=20.04 PMEMKV=stable-1.5",
"OS=fedora OS_VER=34 PMEMKV=master PUSH_IMAGE=1",
"OS=fedora OS_VER=34 PMEMKV=stable-1.4",
"OS=fedora OS_VER=34 PMEMKV=stable-1.5",
"OS=fedora OS_VER=33 PMEMKV=master PUSH_IMAGE=1"]
steps:
- name: Set image version and force image action for stable branch
# we want to set IMG_VER to e.g. '1.x' for stable branches and PRs against them
# for PRs we have to use 'base_ref' - this is the target branch (and we have to check that instead)
if:
startsWith(github.ref, 'refs/heads/stable-') || startsWith(github.base_ref, 'stable-')
# we now know we're on (or against) stable branches, so we just need to pick the version (e.g. the mentioned '1.x')
run: |
IMG_VER=$(echo ${GITHUB_BASE_REF} | cut -d - -f 2)
[ -z "${IMG_VER}" ] \
&& echo "IMG_VER=$(echo ${GITHUB_REF#refs/heads/} | cut -d - -f 2)" >> $GITHUB_ENV \
|| echo "IMG_VER=${IMG_VER}" >> $GITHUB_ENV
echo "FORCE_IMAGE_ACTION=rebuild" >> $GITHUB_ENV
- name: Clone the git repo
uses: actions/checkout@v2
with:
fetch-depth: 0
# "pull" or "rebuild" can be passed to a secret FORCE_IMAGE_ACTION to override default action
- name: Pull the image or rebuild and push it
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./pull-or-rebuild-image.sh $FORCE_IMAGE_ACTION
- name: Run the build
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./build.sh
doc:
name: build and publish docs
runs-on: ubuntu-latest
needs: linux
env:
DOC_UPDATE_GITHUB_TOKEN: ${{ secrets.DOC_UPDATE_GITHUB_TOKEN }}
DOC_UPDATE_BOT_NAME: ${{ secrets.DOC_UPDATE_BOT_NAME }}
DOC_REPO_OWNER: ${{ secrets.DOC_REPO_OWNER }}
if:
github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/stable-')
strategy:
matrix:
CONFIG: ["TYPE=doc OS=fedora OS_VER=34"]
steps:
- name: Set image version for stable branch
if: startsWith(github.ref, 'refs/heads/stable-')
run: |
echo "IMG_VER=$(echo ${GITHUB_REF#refs/heads/} | cut -d - -f 2)" >> $GITHUB_ENV
- name: Clone the git repo
uses: actions/checkout@v2
- name: Pull the image
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./pull-or-rebuild-image.sh pull
- name: Run the build
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./build.sh