various fixes + clippy fix #9
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: Build and Push Nightly Multi-Arch Docker Image | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }}/server | |
jobs: | |
build: | |
runs-on: ${{ matrix.runner }} | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: linux/amd64 | |
runner: ubuntu-latest | |
arch: amd64 | |
- platform: linux/arm64 | |
runner: ubuntu-24.04-arm64 | |
arch: arm64 | |
steps: | |
- name: Give GitHub Actions access to @thirdweb-dev/vault | |
uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd | |
with: | |
ssh-private-key: ${{ secrets.VAULT_REPO_DEPLOY_KEY }} | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # @3.10.0 | |
- name: Log in to Container Registry | |
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # @3.4.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata | |
id: meta | |
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # @5.7.0 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=nightly | |
type=sha,prefix={{branch}}-{{date 'YYYYMMDD'}}- | |
- name: Configure Git for SSH | |
run: | | |
git config --global url."[email protected]:".insteadOf "https://github.com/" | |
- name: Verify SSH agent and add GitHub to known hosts | |
run: | | |
ssh-add -l | |
mkdir -p ~/.ssh | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV | |
- name: Build and push platform-specific image | |
id: build | |
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # @6.18.0 | |
with: | |
context: . | |
file: ./server/Dockerfile | |
platforms: ${{ matrix.platform }} | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly-${{ matrix.arch }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha,scope=nightly-${{ matrix.arch }} | |
cache-to: type=gha,mode=max,scope=nightly-${{ matrix.arch }} | |
ssh: | | |
default=${{ env.SSH_AUTH_SOCK }} | |
- name: Export digest | |
run: | | |
mkdir -p /tmp/digests | |
digest="${{ steps.build.outputs.digest }}" | |
touch "/tmp/digests/${digest#sha256:}" | |
- name: Upload digest | |
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # @4.6.2 | |
with: | |
name: digests-nightly-${{ matrix.arch }} | |
path: /tmp/digests/* | |
if-no-files-found: error | |
retention-days: 1 | |
merge: | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Download digests | |
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # @4.3.0 | |
with: | |
path: /tmp/digests | |
pattern: digests-nightly-* | |
merge-multiple: true | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # @3.10.0 | |
- name: Log in to Container Registry | |
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # @3.4.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata | |
id: meta | |
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # @5.7.0 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=nightly | |
type=sha,prefix={{branch}}-{{date 'YYYYMMDD'}}- | |
- name: Create manifest list and push | |
working-directory: /tmp/digests | |
run: | | |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly-amd64 \ | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly-arm64 | |
- name: Inspect image | |
run: | | |
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly |