Update Lighthouse #6
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: docker | |
on: | |
push: | |
branches: | |
- main | |
env: | |
IMAGE_NAME: ghcr.io/${{ github.repository }} | |
jobs: | |
# Extract the VERSION which is either `latest` or `vX.Y.Z`, and the VERSION_SUFFIX | |
# which is either empty or `-unstable`. | |
# | |
# It would be nice if the arch didn't get spliced into the version between `latest` and | |
# `unstable`, but for now we keep the two parts of the version separate for backwards | |
# compatibility. | |
extract-version: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Extract version (if main) | |
if: github.event.ref == 'refs/heads/main' | |
run: | | |
echo "VERSION=latest" >> $GITHUB_ENV | |
echo "VERSION_SUFFIX=" >> $GITHUB_ENV | |
outputs: | |
VERSION: ${{ env.VERSION }} | |
VERSION_SUFFIX: ${{ env.VERSION_SUFFIX }} | |
build-docker-single-arch: | |
name: build-docker-x86_64 | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
packages: write | |
needs: [extract-version] | |
env: | |
# We need to enable experimental docker features in order to use `docker buildx` | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
VERSION: ${{ needs.extract-version.outputs.VERSION }} | |
VERSION_SUFFIX: ${{ needs.extract-version.outputs.VERSION_SUFFIX }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
- name: Dockerhub login | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io --username "${{ github.repository_owner }}" --password-stdin | |
- name: Map x86_64 to amd64 short arch | |
run: echo "SHORT_ARCH=amd64" >> $GITHUB_ENV; | |
- name: Build Dockerfile and push | |
run: | | |
docker buildx build \ | |
--platform=linux/${SHORT_ARCH} \ | |
--file ./Dockerfile . \ | |
--tag ${IMAGE_NAME}:${VERSION}${VERSION_SUFFIX} \ | |
--provenance=false \ | |
--push | |