Skip to content

Commit

Permalink
Update ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferret-san committed Nov 18, 2024
1 parent 7352562 commit d272b66
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,20 @@ jobs:
id: clean_branch
run: |
# Replace invalid characters with dash
CLEAN_BRANCH=$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9.]/-/g')
echo "name=$CLEAN_BRANCH" >> $GITHUB_OUTPUT
CLEAN_BRANCH="$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9.]/-/g')"
echo "name=${CLEAN_BRANCH}" >> "$GITHUB_OUTPUT"
- name: Set build environment
run: |
echo "REGISTRY=${{ env.REGISTRY }}" >> $GITHUB_ENV
echo "REPOSITORY=${{ env.REPO }}" >> $GITHUB_ENV
echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "GIT_DATE=$(git show -s --format='%ct')" >> $GITHUB_ENV
echo "GIT_VERSION=untagged" >> $GITHUB_ENV
echo "IMAGE_TAGS=${{ github.sha }},${{ steps.clean_branch.outputs.name }}" >> $GITHUB_ENV
echo "PLATFORMS=linux/amd64" >> $GITHUB_ENV
{
echo "REGISTRY=${{ env.REGISTRY }}"
echo "REPOSITORY=${{ env.REPO }}"
echo "GIT_COMMIT=$(git rev-parse HEAD)"
echo "GIT_DATE=$(git show -s --format='%ct')"
echo "GIT_VERSION=untagged"
echo "IMAGE_TAGS=${{ github.sha }},${{ steps.clean_branch.outputs.name }}"
echo "PLATFORMS=linux/amd64"
} >> "$GITHUB_ENV"
- name: Build Docker image
run: |
Expand All @@ -86,15 +88,15 @@ jobs:
--progress plain \
--builder=buildx-build \
-f docker-bake.hcl \
$OUTPUT_ARG \
${{ matrix.docker_name }}
"${OUTPUT_ARG}" \
"${{ matrix.docker_name }}"
- name: Save Docker image for testing
- name: Save Docker image
if: github.event_name == 'pull_request'
run: |
CLEAN_TAG="${{ steps.clean_branch.outputs.name }}"
IMAGE_NAME="${{ env.REGISTRY }}/${{ env.REPO }}/${{ matrix.docker_name }}:${CLEAN_TAG}"
docker save "$IMAGE_NAME" > "/tmp/${{ matrix.docker_name }}.tar"
docker save "${IMAGE_NAME}" > "/tmp/${{ matrix.docker_name }}.tar"
- name: Upload Docker image
if: github.event_name == 'pull_request'
Expand Down

0 comments on commit d272b66

Please sign in to comment.