fix: validate for empty group ID/namespace (#284) #7
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
| # yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json | |
| --- | |
| name: Push to registry | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*.*.*' | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Install node 24 | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - name: Install project modules | |
| run: npm ci | |
| - name: Compile project | |
| run: npm run compile | |
| - name: Determine package version | |
| id: version | |
| run: | | |
| if [[ "${GITHUB_REF}" =~ refs/tags/ ]]; then | |
| # Release tag | |
| VERSION="${GITHUB_REF#refs/tags/v}" | |
| EA_BUILD=false | |
| elif [ "${GITHUB_REF}" = "refs/heads/main" ]; then | |
| # EA build for main | |
| BASE=$(node -p "require('./package.json').version" | sed -E 's/-ea[.-][0-9]+$//') | |
| SHORT_SHA=$(git rev-parse --short "${GITHUB_SHA}") | |
| VERSION="${BASE}-ea.${SHORT_SHA}" | |
| EA_BUILD=true | |
| else | |
| echo "Not building image for this branch" | |
| exit 0 | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "ea_build=$EA_BUILD" >> $GITHUB_OUTPUT | |
| - name: Get image metadata | |
| id: image-meta | |
| run: | | |
| echo "revision=${{ github.sha }}" >> $GITHUB_OUTPUT | |
| echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=latest,enable=${{ steps.version.outputs.ea_build == 'true' }} | |
| type=raw,value=${{ steps.version.outputs.version }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./docker-image/Dockerfiles/Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| IMAGE_VERSION=${{ steps.version.outputs.version }} | |
| IMAGE_REVISION=${{ steps.image-meta.outputs.revision }} | |
| IMAGE_CREATED=${{ steps.image-meta.outputs.created }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| provenance: true | |
| sbom: true |