1+ name : CI
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches : [main]
7+ workflow_dispatch :
8+
9+ jobs :
10+
11+ prepare :
12+ name : Determine image tag
13+ runs-on : ubuntu-latest
14+ if : |
15+ github.ref_name == 'main' ||
16+ startsWith(github.ref_name, 'feature/') ||
17+ startsWith(github.ref_name, 'bugfix/') ||
18+ (github.event_name == 'pull_request' && (startsWith(github.head_ref, 'feature/') || startsWith(github.head_ref, 'bugfix/')))
19+ outputs :
20+ image_tag : ${{ steps.determine-tag.outputs.image_tag }}
21+ version : ${{ steps.determine-tag.outputs.version }}
22+ steps :
23+ - name : Determine base tag
24+ id : determine-tag
25+ run : |
26+ if [ "${{ github.event_name }}" = "pull_request" ] ; then
27+ SHORT_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8)
28+ BRANCH_NAME="${{ github.head_ref }}"
29+ else
30+ SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
31+ BRANCH_NAME="${{ github.ref_name }}"
32+ fi
33+
34+ if [ "${{ github.ref_name }}" = "main" ] ; then
35+ echo "Processing main branch"
36+ echo "image_tag=dev-${SHORT_SHA}" | tee -a $GITHUB_OUTPUT
37+ echo "version=dev-${SHORT_SHA}" | tee -a $GITHUB_OUTPUT
38+ else
39+ # This covers feature/ and bugfix/ branches
40+ echo "Processing feature/bugfix branch ${BRANCH_NAME}"
41+ echo "image_tag=feature-${SHORT_SHA}" | tee -a $GITHUB_OUTPUT
42+ echo "version=feature-${SHORT_SHA}" | tee -a $GITHUB_OUTPUT
43+ fi
44+
45+ build-oci-image :
46+ name : Build OCI images
47+ needs : prepare
48+ uses : iExecBlockchainComputing/github-actions-workflows/.github/workflows/docker-build.yml@feature/allow-args-for-docker-build
49+ with :
50+ image-name : docker-regis.iex.ec/cvm-base
51+ image-tag : ${{ needs.prepare.outputs.image_tag }}
52+ dockerfile : Dockerfile
53+ context : .
54+ registry : docker-regis.iex.ec
55+ push : false
56+ security-scan : false
57+ security-report : " table"
58+ hadolint : false
59+ platforms : linux/amd64
60+ build-args : VERSION=${{ needs.prepare.outputs.version }}
61+ secrets :
62+ username : ${{ secrets.NEXUS_USERNAME }}
63+ password : ${{ secrets.NEXUS_PASSWORD }}
0 commit comments