Skip to content

Commit

Permalink
Test env setup
Browse files Browse the repository at this point in the history
  • Loading branch information
tzununbekov committed Feb 20, 2024
1 parent 857ca78 commit 3c07ba9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
39 changes: 32 additions & 7 deletions .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,46 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21.x'

- name: Prepare environment
run: |
echo "BUILD_NUMBER=${{ github.repository }}-${{ github.workflow }}-${{ github.run_id }}-ghactions" >> $GITHUB_ENV
echo "BUILD_COMMIT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
echo "BUILD_BRANCH_SAFE=${{ github.ref }}" >> $GITHUB_ENV
echo "BUILD_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "BUILD_BRANCH=${{ github.ref }}" >> $GITHUB_ENV
RELEASE_BUILD=false
if [[ "${GITHUB_REF}" == /refs/tags/* ]]; then RELEASE_BUILD=true; fi
- name: Generate env file
run: go run mage.go -v GenerateEnvFile
RC_BUILD=false
if [[ "${GITHUB_REF}" == /refs/tags/*-rc ]]; then RC_BUILD=true; fi
SNAPSHOT_BUILD=false
if [[ "${GITHUB_REF}" == "refs/heads/master" ]]; then SNAPSHOT_BUILD=true; fi
PR_BUILD=false
if [[ "${SNAPSHOT_BUILD}" == "false" && "${RELEASE_BUILD}" == "false" ]]; then PR_BUILD=true; fi
BUILD_NUMBER="${{ github.run_id }}"-ghactions
if [[ "${RELEASE_BUILD}" == "true" ]]; then
BUILD_VERSION="${GITHUB_REF#/refs/tags/}";
elif [[ "${SNAPSHOT_BUILD}" == "true" ]]; then
BUILD_VERSION="$(git describe --abbrev=0 --tags)"-1snapshot-"$(date '+%Y%m%dT%H%M')"-"$(echo ${GITHUB_SHA} | cut -c1-8)";
elif [[ "${PR_BUILD}" == "true" ]]; then
BUILD_VERSION="$(git describe --abbrev=0 --tags)"-1branch-"${GITHUB_REF_NAME}";
fi
echo "export RELEASE_BUILD=$RELEASE_BUILD;" >> build/env.sh
echo "export RC_BUILD=$RC_BUILD;" >> build/env.sh
echo "export SNAPSHOT_BUILD=$SNAPSHOT_BUILD;" >> build/env.sh
echo "export BUILD_NUMBER=$BUILD_NUMBER;" >> build/env.sh
echo "export BUILD_VERSION=$BUILD_VERSION;" >> build/env.sh
# - name: Generate env file
# run: go run mage.go -v GenerateEnvFile

# - name: Create bucket
# if: github.event_name == 'push'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/tests-and-linters.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Tests
# on:
on:
# pull_request:
workflow_call:

env:
GOFLAGS: "-count=1"
Expand Down

0 comments on commit 3c07ba9

Please sign in to comment.