mirror of
https://github.com/simple-login/app.git
synced 2024-11-13 07:31:12 +01:00
Merge pull request #980 from simple-login/ci/generate-build-info-on-script
Move generation of build info to script
This commit is contained in:
commit
6880fe2150
2 changed files with 22 additions and 5 deletions
12
.github/workflows/main.yml
vendored
12
.github/workflows/main.yml
vendored
|
@ -84,6 +84,11 @@ jobs:
|
|||
run: |
|
||||
CONFIG=tests/test.env poetry run alembic upgrade head
|
||||
|
||||
- name: Prepare version file
|
||||
run: |
|
||||
scripts/generate-build-info.sh ${{ github.ref }}
|
||||
cat app/build_info.py
|
||||
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
poetry run pytest
|
||||
|
@ -120,11 +125,8 @@ jobs:
|
|||
|
||||
- name: Prepare version file
|
||||
run: |
|
||||
BUILD_INFO_FILE=app/build_info.py
|
||||
echo "SHA1 = '${{ github.ref }}'" > $BUILD_INFO_FILE
|
||||
BUILD_TIME=$(date +%s)
|
||||
echo "BUILD_TIME = '${BUILD_TIME}' >> $BUILD_INFO_FILE
|
||||
cat $BUILD_INFO_FILE
|
||||
scripts/generate-build-info.sh ${{ github.ref }}
|
||||
cat app/build_info.py
|
||||
|
||||
- name: Build image and publish to Docker Registry
|
||||
uses: docker/build-push-action@v3
|
||||
|
|
15
scripts/generate-build-info.sh
Executable file
15
scripts/generate-build-info.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" || exit 1; pwd -P)"
|
||||
REPO_ROOT=$(echo "${SCRIPT_DIR}" | sed 's:scripts::g')
|
||||
BUILD_INFO_FILE="${REPO_ROOT}/app/build_info.py"
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "This script needs to be invoked with the version as an argument"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION="$1"
|
||||
echo "SHA1 = \"${VERSION}\"" > $BUILD_INFO_FILE
|
||||
BUILD_TIME=$(date +%s)
|
||||
echo "BUILD_TIME = \"${BUILD_TIME}\"" >> $BUILD_INFO_FILE
|
Loading…
Reference in a new issue