Added makefile #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |