fix(ci): suppress permission denied in ensure-gitignore.sh #64
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 Container Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'version.txt' | |
| - 'image/**' | |
| - '.devcontainer/manage/**' | |
| - '.devcontainer/additions/**' | |
| - '.github/workflows/build-image.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| packages: write | |
| # Only one image build at a time | |
| concurrency: | |
| group: build-image | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Read version from version.txt | |
| id: version | |
| run: echo "VERSION=$(cat version.txt | tr -d '[:space:]')" >> $GITHUB_OUTPUT | |
| - name: Repository name to lowercase | |
| id: repo | |
| run: echo "name=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT | |
| - name: Set up QEMU (for arm64 emulation) | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push multi-arch image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: image/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: | | |
| ghcr.io/${{ steps.repo.outputs.name }}:${{ steps.version.outputs.VERSION }} | |
| ghcr.io/${{ steps.repo.outputs.name }}:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Update DCT_IMAGE_VERSION in user template | |
| run: | | |
| VERSION="${{ steps.version.outputs.VERSION }}" | |
| sed -i "s/\"DCT_IMAGE_VERSION\": \"[^\"]*\"/\"DCT_IMAGE_VERSION\": \"${VERSION}\"/" devcontainer-user-template.json | |
| if git diff --quiet devcontainer-user-template.json; then | |
| echo "DCT_IMAGE_VERSION already up to date" | |
| else | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add devcontainer-user-template.json | |
| git commit -m "chore: update DCT_IMAGE_VERSION to ${VERSION} [skip ci]" | |
| git pull --rebase | |
| git push | |
| echo "Updated DCT_IMAGE_VERSION to ${VERSION}" | |
| fi | |
| - name: Image summary | |
| run: | | |
| echo "## Container Image Published" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Version:** ${{ steps.version.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Image:** \`ghcr.io/${{ steps.repo.outputs.name }}:${{ steps.version.outputs.VERSION }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Latest:** \`ghcr.io/${{ steps.repo.outputs.name }}:latest\`" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Platforms:** linux/amd64, linux/arm64" >> $GITHUB_STEP_SUMMARY |