-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (100 loc) · 3.53 KB
/
release.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
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
name: Create Release
on:
push:
tags:
- "*.*.*"
jobs:
# From the tag we split the individual version components:
# major.minor.patch.stage<N>.
version:
name: Apply version
runs-on: ubuntu-latest
steps:
- name: split
id: split
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo $VERSION
PARTS=(${VERSION//\./ })
MAJOR=${PARTS[0]}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "major=${MAJOR}" >> $GITHUB_OUTPUT
echo "minor=${PARTS[1]}" >> $GITHUB_OUTPUT
PARTS2=( $(grep -Eo '[[:digit:]]+|[^[:digit:]]+' <<< ${PARTS[2]} ) )
echo "patch=${PARTS2[0]}" >> $GITHUB_OUTPUT
echo "stage=${PARTS2[1]}" >> $GITHUB_OUTPUT
echo "build=${PARTS2[2]}" >> $GITHUB_OUTPUT
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get branch on which the tag is based
id: branchname
run: |
# get the branch on which the tag is based
raw=$(git branch -r --contains ${{ github.ref }})
# delete the name of the branch up to and including 'origin/'
branch=$(echo $raw | sed 's/.*origin\///')
echo "branch=${branch}" >> $GITHUB_OUTPUT
outputs:
version: ${{ steps.split.outputs.version }}
major: ${{ steps.split.outputs.major }}
minor: ${{ steps.split.outputs.minor }}
patch: ${{ steps.split.outputs.patch }}
stage: ${{ steps.split.outputs.stage }}
build: ${{ steps.split.outputs.build }}
branch: ${{ steps.branchname.outputs.branch }}
# find the current version of vantage6
find-current-vantage6-version:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Find current version
id: find-current-vantage6-version
run: |
version=$(python -c "from vantage6.common import __version__; print(__version__)")
echo "v6_version=${version}" >> $GITHUB_OUTPUT
outputs:
v6_version: ${{ steps.find-current-vantage6-version.outputs.v6_version }}
github-release:
runs-on: ubuntu-latest
needs: [version, find-current-vantage6-version]
env:
version: ${{ needs.version.outputs.version }}
stage: ${{ needs.version.outputs.stage }}
branch: ${{ needs.version.outputs.branch }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{env.branch}}
- name: Release
uses: softprops/action-gh-release@v2
with:
prerelease: ${{ env.stage != '' }}
create-docker-image:
runs-on: ubuntu-latest
needs: [version, find-current-vantage6-version]
env:
version: ${{ needs.version.outputs.version }}
branch: ${{ needs.version.outputs.branch }}
v6_version: ${{ needs.find-current-vantage6-version.outputs.v6_version }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Login to Docker registry
uses: docker/login-action@v3
with:
registry: harbor2.vantage6.ai
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Publish Docker image
run: make image TAG=$version PUSH_REG=true VANTAGE6_VERSION=$v6_version