v1.5.4-preview.0 #34
Workflow file for this run
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: devcontainer | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| docker_tag: | |
| description: Descriptive name of the devcontainer for the Docker tag | |
| required: true | |
| type: string | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - ".devcontainer/**" | |
| - ".github/workflows/devcontainer.yml" | |
| - "!.devcontainer/devcontainer.json" | |
| release: | |
| types: [published] | |
| jobs: | |
| build-and-push: | |
| # The runner even if 24.04 doesn't have glibc 2.38+ as it should. | |
| # So using a lower glibc version for better compatibility. | |
| runs-on: ubuntu-latest-4-cores | |
| env: | |
| DOCKER_TAG: latest | |
| outputs: | |
| tag_name: ${{ steps.release_info.outputs.tag_name }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v1 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v1 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set Docker tag for release event | |
| if: github.event_name == 'release' | |
| run: | | |
| echo "DOCKER_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV | |
| echo "tag_name=$DOCKER_TAG" >> $GITHUB_OUTPUT | |
| - name: Set Docker tag for push event | |
| if: github.event_name == 'push' | |
| run: | | |
| SHORT_SHA=$(echo "${{ github.sha }}" | cut -c 1-7) | |
| echo "DOCKER_TAG=$SHORT_SHA" >> $GITHUB_ENV | |
| - name: Set Docker tag for workflow_dispatch event | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| echo "DOCKER_TAG=${{ inputs.docker_tag }}" >> $GITHUB_ENV | |
| - name: Set outputs | |
| id: release_info | |
| run: | | |
| echo "tag_name=${{ env.DOCKER_TAG }}" >> $GITHUB_OUTPUT | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v2 | |
| with: | |
| push: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch' }} | |
| file: .devcontainer/Dockerfile | |
| tags: ghcr.io/${{ github.repository }}-dev:latest,ghcr.io/${{ github.repository }}-dev:${{ env.DOCKER_TAG }} | |
| build-args: | | |
| RUST_VERSION=1.85.0 | |
| BUILD_TYPE=${{ github.event_name }} | |
| DOJO_VERSION=${{ github.event.release.tag_name }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=registry,ref=ghcr.io/${{ github.repository }}-dev:latest |