Add option to set tool to open by default #949
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: Docker build and push | |
| # limit concurrency per ref; cancel in-progress runs for PRs | |
| # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#examples-using-concurrency-and-the-default-behavior | |
| concurrency: | |
| group: docker-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| on: | |
| push: | |
| # Only activate for `master` branch | |
| branches: | |
| - master | |
| - development | |
| # Plus for all tags | |
| tags: | |
| - "*" | |
| # Plus for any pull-requests | |
| pull_request: | |
| branches: | |
| - master | |
| - development | |
| # And for any final releases | |
| release: | |
| types: [published] | |
| env: | |
| # Will be "NASA-AMMOS/MMGIS" for the main repo, for forks "user-name-of-fork/MMGIS" | |
| # For generating the tag, all will be converted to lowercase | |
| IMAGE_SLUG: ${{ github.repository }} | |
| jobs: | |
| # Generate shared tags for both architectures as a JSON array. | |
| # The image tag pattern is: | |
| # for pull-requests: <PATCH_VERSION>-<DATE>-<PR_NUMBER>, eg: 4.2.33-20210125-25 | |
| # for tags: <TAG> | |
| # for `master` branch: latest,<PATCH_VERSION>-latest,<MINOR_VERSION>-latest,<MAJOR_VERSION>-latest,<PATCH_VERSION>-<DATE>-<SHA> | |
| # for `development` branch: development,<MAJOR_VERSION>-development,<PATCH_VERSION>-<DATE>-<SHA> | |
| # for releases: release,<PATCH_VERSION>-release,<MINOR_VERSION>-release,<MAJOR_VERSION>-release,<PATCH_VERSION>-<DATE>-<SHA> | |
| # Version is parsed from package.json (date suffix stripped before use in tags) | |
| generate-tags: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tags: ${{ steps.generate.outputs.TAGS }} | |
| image-id: ${{ steps.generate.outputs.IMAGE_ID }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Generate tags | |
| id: generate | |
| run: | | |
| # Image ID | |
| IMAGE_ID=ghcr.io/$IMAGE_SLUG | |
| # Date | |
| BDATE=$(date +%Y%m%d) | |
| # RAW_VERSION from package.json may be "4.2.33-20260327" (date-suffixed by bump-version workflow). | |
| # Strip the date suffix before parsing semver components so it doesn't appear twice in image tags. | |
| RAW_VERSION=$(jq .version -r ./package.json) | |
| BASE_VERSION=$(echo $RAW_VERSION | sed 's/-[0-9]\{8\}$//') | |
| PATCH_VERSION=$BASE_VERSION | |
| MINOR_VERSION=${PATCH_VERSION%.*} | |
| MAJOR_VERSION=${MINOR_VERSION%.*} | |
| # Change all uppercase to lowercase, just in case | |
| IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
| # Strip git ref prefix from version and use it as suffix for version | |
| VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
| # For pull requests just extract the PR number | |
| PR_NUMBER="" | |
| [ "${{ github.event_name }}" == "pull_request" ] && VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\)/merge,\1,') | |
| [ "${{ github.event_name }}" == "pull_request" ] && PR_NUMBER=$VERSION | |
| # Append version | |
| [ "${{ github.event_name }}" == "pull_request" ] && VERSION=$PATCH_VERSION-$BDATE-$VERSION | |
| # Strip "v" prefix from tag name if it's a tag | |
| # [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
| # Use Docker `latest` tag convention if it's a master branch build | |
| [ "$VERSION" == "master" ] && VERSION=latest | |
| [ "$VERSION" == "development" ] && VERSION=development | |
| [ "${{ github.event_name }}" == "release" ] && VERSION=release | |
| SHA_SHORT=$(git rev-parse --short HEAD) | |
| [ "${{ github.event_name }}" == "pull_request" ] && SHA_SHORT=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8) | |
| # Build TAGS as a JSON array of tag names (no --tag flags, no image ID prefix). | |
| # Arch-specific suffixes (-amd64, -arm64) and the combined manifest are applied by later jobs. | |
| # Specific/versioned tags are listed first; floating tags (development, latest, release) are last | |
| # so that GHCR features the floating tag as the most recently published version. | |
| TAGS=$(jq -cn --arg v "$VERSION" '[$v]') | |
| [ "$VERSION" == "latest" ] && TAGS=$(jq -cn \ | |
| --arg a "$PATCH_VERSION-$BDATE-$SHA_SHORT" \ | |
| --arg b "$MAJOR_VERSION-latest" \ | |
| --arg c "$MINOR_VERSION-latest" \ | |
| --arg d "$PATCH_VERSION-latest" \ | |
| --arg e "latest" \ | |
| '[$a,$b,$c,$d,$e]') | |
| [ "$VERSION" == "development" ] && TAGS=$(jq -cn \ | |
| --arg a "$PATCH_VERSION-$BDATE-$SHA_SHORT" \ | |
| --arg b "$MAJOR_VERSION-development" \ | |
| --arg c "development" \ | |
| '[$a,$b,$c]') | |
| [ "$VERSION" == "release" ] && TAGS=$(jq -cn \ | |
| --arg a "$PATCH_VERSION-$BDATE-$SHA_SHORT" \ | |
| --arg b "$MAJOR_VERSION-release" \ | |
| --arg c "$MINOR_VERSION-release" \ | |
| --arg d "$PATCH_VERSION-release" \ | |
| --arg e "release" \ | |
| '[$a,$b,$c,$d,$e]') | |
| echo IMAGE_ID=$IMAGE_ID | |
| echo TAGS=$TAGS | |
| echo "TAGS=$TAGS" >> $GITHUB_OUTPUT | |
| echo "IMAGE_ID=$IMAGE_ID" >> $GITHUB_OUTPUT | |
| # Build and push ARM64 image on ARM64 runner | |
| build-arm64: | |
| needs: generate-tags | |
| runs-on: ubuntu-24.04-arm # ARM64 runner for native ARM64 builds | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| driver-opts: | | |
| image=moby/buildkit:latest | |
| - name: Docker buildx build and push (ARM64) | |
| env: | |
| DOCKER_BUILDKIT: 1 | |
| run: | | |
| IMAGE_ID="${{ needs.generate-tags.outputs.image-id }}" | |
| # Build --tag flags: add -arm64 suffix to every tag | |
| TAG_FLAGS=$(echo '${{ needs.generate-tags.outputs.tags }}' | jq -r '.[]' | \ | |
| while read tag; do echo "--tag $IMAGE_ID:$tag-arm64"; done | tr '\n' ' ') | |
| # Only disable cache for releases | |
| CACHE_FLAG="" | |
| [ "${{ github.event_name }}" = "release" ] && CACHE_FLAG="--no-cache" | |
| docker buildx build \ | |
| $TAG_FLAGS \ | |
| --push \ | |
| --platform linux/arm64 \ | |
| --cache-from type=registry,ref=$IMAGE_ID:buildcache-arm64 \ | |
| --cache-to type=registry,ref=$IMAGE_ID:buildcache-arm64,mode=max \ | |
| --build-arg PUBLIC_URL_ARG=${{ secrets.PUBLIC_URL }} \ | |
| $CACHE_FLAG \ | |
| . | |
| # Build and push AMD64 image on x64 runner | |
| build-amd64: | |
| needs: generate-tags | |
| runs-on: ubuntu-latest # x64 runner for native AMD64 builds | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| driver-opts: | | |
| image=moby/buildkit:latest | |
| - name: Docker buildx build and push (AMD64) | |
| env: | |
| DOCKER_BUILDKIT: 1 | |
| run: | | |
| IMAGE_ID="${{ needs.generate-tags.outputs.image-id }}" | |
| # Build --tag flags: add -amd64 suffix to every tag | |
| TAG_FLAGS=$(echo '${{ needs.generate-tags.outputs.tags }}' | jq -r '.[]' | \ | |
| while read tag; do echo "--tag $IMAGE_ID:$tag-amd64"; done | tr '\n' ' ') | |
| # Only disable cache for releases | |
| CACHE_FLAG="" | |
| [ "${{ github.event_name }}" = "release" ] && CACHE_FLAG="--no-cache" | |
| docker buildx build \ | |
| $TAG_FLAGS \ | |
| --push \ | |
| --platform linux/amd64 \ | |
| --cache-from type=registry,ref=$IMAGE_ID:buildcache-amd64 \ | |
| --cache-to type=registry,ref=$IMAGE_ID:buildcache-amd64,mode=max \ | |
| --build-arg PUBLIC_URL_ARG=${{ secrets.PUBLIC_URL }} \ | |
| $CACHE_FLAG \ | |
| . | |
| # Create multi-arch manifests combining the AMD64 and ARM64 images | |
| create-manifests: | |
| needs: [generate-tags, build-amd64, build-arm64] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Create multi-arch manifests | |
| run: | | |
| IMAGE_ID="${{ needs.generate-tags.outputs.image-id }}" | |
| echo '${{ needs.generate-tags.outputs.tags }}' | jq -r '.[]' | while read tag; do | |
| echo "Creating manifest for $IMAGE_ID:$tag" | |
| docker buildx imagetools create \ | |
| -t $IMAGE_ID:$tag \ | |
| $IMAGE_ID:$tag-amd64 \ | |
| $IMAGE_ID:$tag-arm64 | |
| done |