Add devcontainer for codespaces #5
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: Build build-tools image | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| type: string | |
| required: false | |
| description: "Optional explicit tag to publish (in addition to main/pr tags)" | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - tools/build-tools/** | |
| - .devcontainer/devcontainer.json | |
| - .github/workflows/build-tools.yaml | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} | |
| IMAGE_NAME: build-tools | |
| jobs: | |
| build: | |
| name: build-tools | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set tags | |
| id: tags | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| sha="$(git rev-parse --short=12 HEAD)" | |
| tags="" | |
| if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then | |
| tags="${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:main,${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:main-${sha}" | |
| elif [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| pr="${{ github.event.pull_request.number }}" | |
| tags="${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${pr}-${sha}" | |
| else | |
| tags="${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:manual-${sha}" | |
| fi | |
| if [[ -n "${{ inputs.tag }}" ]]; then | |
| tags="${tags},${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.tag }}" | |
| fi | |
| echo "tags=${tags}" >> "$GITHUB_OUTPUT" | |
| - name: Setup QEMU | |
| uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 | |
| - name: Setup Buildx | |
| uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 | |
| - name: Login to GHCR | |
| if: ${{ github.event_name != 'pull_request' }} | |
| uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 | |
| with: | |
| registry: ${{ env.IMAGE_REGISTRY }} | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build (and optionally push) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: tools/build-tools | |
| file: tools/build-tools/Dockerfile | |
| push: ${{ github.event_name != 'pull_request' }} | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.tags.outputs.tags }} | |
| build-args: | | |
| VERSION=${{ github.sha }} | |