Skip to content

Commit 4bf0eb7

Browse files
authored
Merge pull request #25 from vidyasilai/add_release_stage
Add release stage to CI pipeline
2 parents c14af1c + df1f539 commit 4bf0eb7

4 files changed

Lines changed: 48 additions & 33 deletions

File tree

‎.github/workflows/main.yml‎

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,22 @@ jobs:
2727
#----- --- -- - - - -
2828
- name: Build and test
2929
env:
30-
CACHE_CONAN_REMOTE: ${{ vars.CACHE_CONAN_REMOTE }}
31-
CACHE_CONAN_LOGIN_USERNAME: ${{ vars.CACHE_CONAN_LOGIN_USERNAME }}
32-
CACHE_CONAN_PASSWORD: ${{ secrets.CACHE_CONAN_PASSWORD }}
33-
run: scripts/ci-build-with-docker.sh
34-
#release:
35-
# if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
36-
# runs-on: self-hosted
37-
# needs:
38-
# - build
39-
# - test
40-
# steps:
41-
# - name: make_export-pkg
42-
# run: script/run-with-docker.sh make BUILD_TYPE=Release export-pkg
43-
# - name: publish-release
44-
# env:
45-
# RELEASE_CONAN_REMOTE: ${{ vars.RELEASE_CONAN_REMOTE }}
46-
# RELEASE_CONAN_LOGIN_USERNAME: ${{ vars.RELEASE_CONAN_LOGIN_USERNAME }}
47-
# RELEASE_CONAN_PASSWORD: ${{ secrets.RELEASE_CONAN_PASSWORD }}
48-
# EXPORT_PKG_ONLY: 1
49-
# run: script/run-with-docker.sh script/publish-release.sh
30+
CI_JOB_NAME: build_and_test
31+
run: scripts/ci-job-with-docker.sh
32+
#+++++++++++-+-+--+----- --- -- - - - -
33+
release:
34+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
35+
runs-on: self-hosted
36+
defaults:
37+
run:
38+
shell: bash
39+
needs:
40+
- build_and_test
41+
steps:
42+
- name: Release
43+
env:
44+
RELEASE_CONAN_REMOTE: ${{ vars.RELEASE_CONAN_REMOTE }}
45+
RELEASE_CONAN_LOGIN_USERNAME: ${{ vars.RELEASE_CONAN_LOGIN_USERNAME }}
46+
RELEASE_CONAN_PASSWORD: ${{ secrets.RELEASE_CONAN_PASSWORD }}
47+
CI_JOB_NAME: release
48+
run: scripts/ci-job-with-docker.sh
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ set -Eeuo pipefail
55
SCRIPT_DIR=$(realpath $(dirname "$0"))
66
PROJECT_DIR=$(realpath $(dirname "${SCRIPT_DIR}"))
77

8-
"${SCRIPT_DIR}/ci-print-diagnostics.sh" "ci-build-with-docker.sh"
8+
"${SCRIPT_DIR}/ci-print-diagnostics.sh" "ci-job-with-docker.sh"
99

10-
# Run the ci-build.sh script using docker.
10+
# Run the ci-job.sh script using docker.
1111
#
1212
ROOT_IMAGE=registry.gitlab.com/batteriesincluded/batt-docker/batteries-debian12-build-tools:0.6.0
13-
USER_IMAGE=$(cor docker user-image ${ROOT_IMAGE} --user-commands-file="${SCRIPT_DIR}/ci-build-setup.dockerfile")
13+
USER_IMAGE=$(cor docker user-image ${ROOT_IMAGE} --user-commands-file="${SCRIPT_DIR}/ci-job-setup.dockerfile")
1414

1515
VOLUMES=
1616
if [ -f "${HOME}/conan-local-cache-server-config.sh" ]; then
@@ -34,4 +34,4 @@ docker run \
3434
${VOLUMES} \
3535
--workdir "${PROJECT_DIR}" \
3636
${USER_IMAGE} \
37-
"${BUILD_COMMAND:-${SCRIPT_DIR}/ci-build.sh}"
37+
"${BUILD_COMMAND:-${SCRIPT_DIR}/ci-job.sh}"
Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,28 @@ fi
2727
#
2828
cor select --clean --profile=linux-gcc12-x86_64 --build-type=Release
2929

30-
# Build.
31-
#
32-
# cor install makes sure deps are uploaded to the cache server first;
33-
# TODO [tastolfi 2025-09-27] - Add a `cor pre-cache <options> <package_name>/<version> ...` command
34-
#
35-
cor clean
36-
cor install
37-
cor build
38-
cor test --only
30+
: "${CI_JOB_NAME:?Error: CI_JOB_NAME environment variable must be set}"
31+
32+
case "$CI_JOB_NAME" in
33+
build_and_test)
34+
echo "Running build_and_test job..."
35+
# Build.
36+
#
37+
# cor install makes sure deps are uploaded to the cache server first;
38+
# TODO [tastolfi 2025-09-27] - Add a `cor pre-cache <options> <package_name>/<version> ...` command
39+
#
40+
cor install --clean
41+
cor build
42+
cor test --only
43+
;;
44+
release)
45+
echo "Running release job..."
46+
cor export --only
47+
cor export-pkg --clean
48+
cor upload
49+
;;
50+
*)
51+
echo "Unknown job type: $CI_JOB_NAME"
52+
exit 1
53+
;;
54+
esac

0 commit comments

Comments
 (0)