tests: benchmarks: current_consumption: Remove invalid code #764
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Docker Image | |
on: | |
push: | |
tags: | |
- 'v*' | |
branches: # Trigger on push to main and release branches | |
- main | |
- 'v*-branch' | |
env: | |
IMAGE_NAME: ghcr.io/${{ github.repository }}-toolchain | |
jobs: | |
build: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3 | |
with: | |
registry: ghcr.io | |
username: NordicBuilder | |
password: ${{ secrets.NCS_GITHUB_PKG_WRITE_TOKEN }} | |
- name: Check if Docker image exists | |
id: check-image | |
run: | | |
TOOLCHAIN_ID=$(./scripts/print_toolchain_checksum.sh) | |
echo "TOOLCHAIN_ID=$TOOLCHAIN_ID" >> $GITHUB_OUTPUT | |
if docker manifest inspect ${IMAGE_NAME}:$TOOLCHAIN_ID > /dev/null 2>&1; then | |
echo "exists=true" >> $GITHUB_OUTPUT | |
else | |
echo "exists=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Build and push Docker image | |
if: steps.check-image.outputs.exists == 'false' | |
working-directory: scripts/docker | |
run: | | |
docker build -t ${IMAGE_NAME}:${{steps.check-image.outputs.TOOLCHAIN_ID}} --build-arg VERSION=${{steps.check-image.outputs.TOOLCHAIN_ID}} . | |
docker push ${IMAGE_NAME}:${{steps.check-image.outputs.TOOLCHAIN_ID}} | |
if [[ ${{ github.ref_name }} == "main" ]]; then | |
docker tag ${IMAGE_NAME}:${{steps.check-image.outputs.TOOLCHAIN_ID}} ${IMAGE_NAME}:latest | |
docker push ${IMAGE_NAME}:latest | |
fi | |
- name: Tag and push Docker image for tags | |
if: github.event_name == 'push' && github.ref_type == 'tag' | |
run: | | |
docker pull ${IMAGE_NAME}:${{steps.check-image.outputs.TOOLCHAIN_ID}} | |
docker tag ${IMAGE_NAME}:${{steps.check-image.outputs.TOOLCHAIN_ID}} ${IMAGE_NAME}:${{ github.ref_name }} | |
docker push ${IMAGE_NAME}:${{ github.ref_name }} |