Skip to content

Commit 0a5e3d4

Browse files
committed
ci: #10 fix build version
1 parent 5f99657 commit 0a5e3d4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,19 @@ jobs:
4242

4343
- name: Set env
4444
run: |
45-
echo "CI_SHA_SHORT=$CI_SHA_SHORT" >> $GITHUB_ENV
46-
echo "CI_ACTION_REF_NAME=$CI_ACTION_REF_NAME" >> $GITHUB_ENV
45+
echo "APP_VERSION=$CI_SHA_SHORT" >> $GITHUB_ENV
46+
47+
- name: Set env when tag
48+
if: startsWith(github.ref, 'refs/tags/')
49+
run: |
50+
echo "APP_VERSION=$CI_ACTION_REF_NAME" >> $GITHUB_ENV
4751
4852
- name: build
4953
uses: docker://ecoding/php:8.0
5054
env:
51-
CI_SHA_SHORT: ${{ env.CI_SHA_SHORT }}
55+
APP_VERSION: ${{ env.APP_VERSION }}
5256
with:
53-
args: php coding app:build --build-version=${{ env.CI_SHA_SHORT }}
57+
args: php coding app:build --build-version=${{ env.APP_VERSION }}
5458

5559
- name: Upload Artifact
5660
uses: actions/upload-artifact@v2
@@ -74,11 +78,11 @@ jobs:
7478
if: startsWith(github.ref, 'refs/tags/')
7579
uses: docker/build-push-action@v2
7680
env:
77-
CI_ACTION_REF_NAME: ${{ env.CI_ACTION_REF_NAME }}
81+
APP_VERSION: ${{ env.APP_VERSION }}
7882
with:
7983
push: true
8084
context: .
81-
tags: ecoding/coding-cli:latest,ecoding/coding-cli:${{ env.CI_ACTION_REF_NAME }}
85+
tags: ecoding/coding-cli:latest,ecoding/coding-cli:${{ env.APP_VERSION }}
8286

8387
- name: Image digest
8488
if: steps.docker_build.conclusion == 'success'

0 commit comments

Comments
 (0)