don't use main #10
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
| on: | |
| push: | |
| branches-ignore: | |
| - "gh-readonly-queue/**" | |
| pull_request: | |
| merge_group: | |
| workflow_dispatch: | |
| name: Osiris Hardware CI Container Images | |
| env: | |
| TERM: xterm-256color | |
| jobs: | |
| container: | |
| name: Build Container | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| outputs: | |
| container_name: ${{ steps.set_output.outputs.container_name }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set container name as output | |
| id: set_output | |
| run: | | |
| BRANCH=$(echo "${GITHUB_REF}" | sed 's|refs/heads/||' | tr '[:upper:]' '[:lower:]') | |
| REPO=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]') | |
| if [ "$BRANCH" = "main" ]; then | |
| TAG="latest" | |
| else | |
| TAG="${BRANCH//\//-}" | |
| fi | |
| CONTAINER_NAME="ghcr.io/${REPO}:${TAG}" | |
| echo "container_name=$CONTAINER_NAME" >> $GITHUB_OUTPUT | |
| echo "container_without_tag=ghcr.io/${REPO}" >> $GITHUB_OUTPUT | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v2 | |
| with: | |
| file: Dockerfile | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.set_output.outputs.container_name }} | |
| cache-from: | | |
| type=registry,ref=${{ steps.set_output.outputs.container_name }}-cache | |
| type=registry,ref=${{ steps.set_output.outputs.container_without_tag }}:latest-cache | |
| cache-to: type=registry,ref=${{ steps.set_output.outputs.container_name }}-cache,mode=max |