Skip to content

Commit 5abd287

Browse files
committed
cicd: change docker build to docker buildx build
Signed-off-by: MTsfoni <[email protected]>
1 parent a65998d commit 5abd287

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
3636
steps:
3737
- uses: actions/[email protected]
38+
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 #v3.11.1
3839
- uses: actions/[email protected]
3940
with:
4041
dotnet-version: '8.0'
@@ -47,6 +48,8 @@ jobs:
4748

4849
# Create binaries
4950
- name: Create binaries
51+
env:
52+
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
5053
id: create_binaries
5154
run: |
5255
VERSION=`cat semver.txt`
@@ -58,16 +61,21 @@ jobs:
5861
do
5962
dotnet publish src/cyclonedx/cyclonedx.csproj -r $runtime --configuration Release /p:Version=$VERSION --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesInSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true --output bin/$runtime
6063
done
61-
docker build --sbom=true --provenance mode=max,builder-id="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" --annotation "org.opencontainers.image.url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" --annotation "org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" --annotation "org.opencontainers.image.version=$VERSION" --annotation "org.opencontainers.image.revision=$GITHUB_SHA" --annotation "org.opencontainers.image.created=$(date -Iseconds)" -f Dockerfile --build-arg VERSION=$VERSION -t $REPO:$VERSION -t $REPO:latest .
62-
63-
- name: Publish Docker image to Docker Hub
64-
env:
65-
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
66-
run: |
67-
REPO=cyclonedx/cyclonedx-cli
64+
6865
docker login --username coderpatros --password "$DOCKER_TOKEN"
69-
docker push $REPO:latest
70-
docker push $REPO:${{ steps.create_binaries.outputs.version }}
66+
docker buildx build \
67+
--sbom=true \
68+
--provenance mode=max,builder-id="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
69+
--annotation "org.opencontainers.image.url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
70+
--annotation "org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
71+
--annotation "org.opencontainers.image.version=$VERSION" \
72+
--annotation "org.opencontainers.image.revision=$GITHUB_SHA" \
73+
--annotation "org.opencontainers.image.created=$(date -Iseconds)" \
74+
--build-arg VERSION=$VERSION \
75+
-t $REPO:$VERSION \
76+
-t $REPO:latest \
77+
--push \
78+
-f Dockerfile .
7179
7280
- name: Create github release and git tag for release
7381
id: create_release

0 commit comments

Comments
 (0)