Skip to content

Commit be0ed1f

Browse files
committed
An example bake action (use steps to extract short commits)
1 parent a193b48 commit be0ed1f

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,22 @@ jobs:
6161
- helloworld
6262
steps:
6363

64-
- run: >-
65-
echo short_commit=$(cut -b 1-7 <<<$GITHUB_SHA) >> $GITHUB_ENV
66-
- run: env | sort
67-
6864
- uses: actions/checkout@v3
65+
with:
66+
submodules: 'true'
67+
token: ${{ secrets.ACCESS_TOKEN }}
68+
69+
- id: get_commit_ids
70+
run: |-
71+
set -x
72+
echo short_commit=$(cut -b 1-7 <<<$GITHUB_SHA) >> $GITHUB_OUTPUT
73+
echo scripts_short_commit=$(git submodule status scripts | awk '{substr($1,1,7)}') >> $GITHUB_OUTPUT
6974
75+
- run: |-
76+
echo ${{ steps.get_commit_ids.outputs.short_commit }}
77+
echo ${{ steps.get_commit_ids.outputs.scripts_short_commit }}
78+
79+
7080
- uses: docker/setup-buildx-action@v3
7181
with:
7282
driver: docker
@@ -91,7 +101,6 @@ jobs:
91101
default.args.git_tags=${{ github.ref_name }}
92102
default.args.git_build_time=${{ github.event.head_commit.timestamp }}
93103
default.tags=ghcr.io/${{ github.repository }}:${{ github.ref_name }}
94-
default.tags=ghcr.io/${{ github.repository }}:${{ env.short_commit }}
95104
96105
- name: Inspect image
97106
run: >-

0 commit comments

Comments
 (0)