build(deps): bump semver from 5.7.1 to 5.7.2 #83
This file contains 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: Explorer Image | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
- "v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+" | |
- "v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+" | |
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" | |
pull_request: | |
env: | |
REGISTRY: ghcr.io | |
MAINTAINER: ${{ github.repository_owner }} | |
DESCRIPTION: "${{ github.repository_owner }} repository ${{ github.repository }}" | |
BASE_NAME: "explorer" | |
jobs: | |
prepare-env: | |
runs-on: "ubuntu-latest" | |
outputs: | |
output_short_sha: ${{ steps.setting_env.outputs.short_sha }} | |
output_image_name: ${{ steps.setting_env.outputs.image_name }} | |
steps: | |
- name: Checkout | |
uses: "actions/checkout@v3" | |
- name: Add vars to ENV | |
id: setting_env | |
run: | | |
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV | |
echo "short_sha=`echo ${GITHUB_SHA} | cut -c1-8`" >> "$GITHUB_OUTPUT" | |
# yamllint disable | |
echo "IMAGE_NAME=$(echo ${{ github.repository_owner }}/${{ env.BASE_NAME }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
echo "image_name=$(echo ${{ github.repository_owner }}/${{ env.BASE_NAME }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" | |
# yamllint enable | |
docker-build-base: | |
runs-on: "ubuntu-latest" | |
needs: prepare-env | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Checkout | |
uses: "actions/checkout@v3" | |
- name: Login to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
env: | |
OUTPUT_SHORT_SHA: ${{ needs.prepare-env.outputs.output_short_sha }} | |
OUTPUT_IMAGE_NAME: ${{ needs.prepare-env.outputs.output_image_name }} | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.OUTPUT_IMAGE_NAME }} | |
# yamllint disable | |
labels: | | |
maintainer=${{ env.MAINTAINER }} | |
commitUrl=https://github.com/${{ github.repository }}/commit/${{ github.sha }} | |
dockerPull=docker pull ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.OUTPUT_SHORT_SHA }} | |
org.opencontainers.image.description=${{ env.DESCRIPTION }} | |
tags: | | |
# output minimal (short sha) | |
type=raw,value={{sha}} | |
# output v0.2.1/v*-* | |
type=semver,pattern={{raw}} | |
# pull request event | |
type=ref,enable=true,prefix=pr-,suffix=,event=pr | |
# yamllint enable | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# We always build the image but we only push if we are on the `main`, | |
# `master` branch or a versioned `v*` branch | |
- name: Build and PushDocker Image | |
uses: docker/build-push-action@v4 | |
env: | |
OUTPUT_SHORT_SHA: ${{ needs.prepare-env.outputs.output_short_sha }} | |
OUTPUT_IMAGE_NAME: ${{ needs.prepare-env.outputs.output_image_name }} | |
with: | |
platforms: linux/amd64 | |
# yamllint disable | |
# The following line, is execute as an if statement, only push when | |
# the branch is main, master or starts with v* | |
push: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }} | |
# yamllint enable | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
file: docker/Dockerfile.build |