fix: fix workflow using target in the build commands #43
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: Release | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - main | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| env: | |
| HTTP_CLI_VERSION: v1.0.1 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 20 | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - run: npm ci | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Create and use buildx builder | |
| run: | | |
| docker buildx create --name shell-runtime-builder --driver docker-container --use | |
| docker buildx inspect shell-runtime-builder --bootstrap | |
| - name: Cache Docker layers | |
| uses: actions/cache@v3 | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: ${{ runner.os }}-buildx-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-buildx- | |
| - name: Get version from semantic-release | |
| id: version | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| echo "Running semantic-release dry-run to extract next version..." | |
| VERSION=$(npx semantic-release --no-ci --dry-run 2>&1 | tee semantic-output.log | grep -oP 'The next release version is \K[0-9]+\.[0-9]+\.[0-9]+' || true) | |
| if [ -z "$VERSION" ]; then | |
| echo "❌ Failed to extract VERSION from semantic-release output:" | |
| cat semantic-output.log | |
| exit 1 | |
| fi | |
| echo "✅ Detected VERSION: $VERSION" | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Build Docker images | |
| run: | | |
| echo "${{ secrets.GHCR_PAT }}" > github_token | |
| export DOCKER_BUILDKIT=1 | |
| VERSION=$VERSION | |
| IMAGE=ghcr.io/ql4b/lambda-shell-runtime | |
| docker buildx build --builder shell-runtime-builder --platform linux/arm64 \ | |
| --build-arg HTTP_CLI_VERSION=$VERSION \ | |
| --output type=registry --progress=plain \ | |
| --secret id=github_token,src=github_token \ | |
| --cache-from type=local,src=/tmp/.buildx-cache \ | |
| --cache-to type=local,dest=/tmp/.buildx-cache \ | |
| -t $IMAGE:base-$VERSION \ | |
| -t $IMAGE:base-latest \ | |
| --target base . | |
| docker buildx build --builder shell-runtime-builder --platform linux/arm64 \ | |
| --build-arg HTTP_CLI_VERSION=$VERSION \ | |
| --output type=registry --progress=plain \ | |
| --secret id=github_token,src=github_token \ | |
| --cache-from type=local,src=/tmp/.buildx-cache \ | |
| --cache-to type=local,dest=/tmp/.buildx-cache \ | |
| -t $IMAGE:tiny-$VERSION \ | |
| -t $IMAGE:tiny-latest \ | |
| --target tiny . | |
| docker buildx build --builder shell-runtime-builder --platform linux/arm64 \ | |
| --build-arg HTTP_CLI_VERSION=$VERSION \ | |
| --output type=registry --progress=plain \ | |
| --secret id=github_token,src=github_token \ | |
| --cache-from type=local,src=/tmp/.buildx-cache \ | |
| --cache-to type=local,dest=/tmp/.buildx-cache \ | |
| -t $IMAGE:micro-$VERSION \ | |
| -t $IMAGE:micro-latest \ | |
| --target micro . | |
| docker buildx build --builder shell-runtime-builder --platform linux/arm64 \ | |
| --build-arg HTTP_CLI_VERSION=$VERSION \ | |
| --output type=registry --progress=plain \ | |
| --secret id=github_token,src=github_token \ | |
| --cache-from type=local,src=/tmp/.buildx-cache \ | |
| --cache-to type=local,dest=/tmp/.buildx-cache \ | |
| -t $IMAGE:full-$VERSION \ | |
| -t $IMAGE:full-latest \ | |
| . | |
| shell: bash | |
| - name: Log in to GHCR | |
| run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u skunxicat --password-stdin | |
| - run: npx semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GHCR_PAT: ${{ secrets.GHCR_PAT }} |