chore: updated to lts node 24 #83
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: container-images | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| tags: [ "v*" ] | |
| jobs: | |
| build-container-image: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3 | |
| - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3 | |
| - name: Set build variables | |
| env: | |
| REPOSITORY: '${{ github.repository }}' | |
| run: | | |
| # tag main if main branch | |
| if [[ "${{ github.ref_name }}" == "main" ]]; then | |
| image_tags=("main") | |
| # tag with tag name if tag | |
| elif [[ "${{ github.ref }}" == refs/tags/v* ]]; then | |
| image_tags=("${{ github.ref_name }}") | |
| # tag with latest if tag is a new major, minor or patch version | |
| if [[ "${{ github.ref_name}}" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then | |
| image_tags+=("latest") | |
| fi | |
| fi | |
| lc_repo=${REPOSITORY,,} | |
| image_paths=() | |
| for tag in ${image_tags[@]}; do | |
| image_paths+=("ghcr.io/$lc_repo:$tag") | |
| done | |
| # join with ',' and then skip first character | |
| ALL_TAGS=$(printf ',%s' "${image_paths[@]}") | |
| echo "ALL_TAGS=${ALL_TAGS:1}" >>$GITHUB_ENV | |
| PROJECT_VERSION="$(git describe --tags --always)" | |
| if [[ "${{ github.ref_type }}" == "tag" ]]; then | |
| PROJECT_VERSION="${{ github.ref_name }}" | |
| fi | |
| echo "PROJECT_VERSION=$PROJECT_VERSION" >>$GITHUB_ENV | |
| echo "PROJECT_COMMIT_HASH=${{ github.sha }}" >>$GITHUB_ENV | |
| - name: Login to ghcr.io | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push default image | |
| uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5 | |
| with: | |
| context: . # Because GH actions are for kids and put protection on everything; https://stackoverflow.com/a/71159809/11276254 | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ env.ALL_TAGS }} | |
| build-args: | | |
| PROJECT_VERSION=${{ env.PROJECT_VERSION }} | |
| PROJECT_COMMIT_HASH=${{ env.PROJECT_COMMIT_HASH }} |