ci: Refactor GitHub workflow and increase code efficiency

- Remove commented out code for `SHORT_SHA` in `.github/workflows/ci.yml`
- Add `SHORT_SHA` environment property with commit short sha in `.github/workflows/ci.yml`
This commit is contained in:
Laisky.Cai 2023-11-17 03:29:51 +00:00
parent 8b477d896d
commit d0c0b9b650

View File

@ -5,9 +5,6 @@ on:
branches: branches:
- 'main' - 'main'
env:
SHORT_SHA: "${GITHUB_SHA} | cut -c1-8`"
jobs: jobs:
docker: docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -49,8 +46,8 @@ jobs:
path: ${{ steps.go-cache-paths.outputs.go-mod }} path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
# - name: Add SHORT_SHA env property with commit short sha - name: Add SHORT_SHA env property with commit short sha
# run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
- -
name: Build and push latest name: Build and push latest