Skip to content

Update theme and styling (#74) #12

Update theme and styling (#74)

Update theme and styling (#74) #12

Workflow file for this run

name: Build Image
on:
push:
branches:
- main
jobs:
build-amd64:
name: amd64 image
runs-on: ubuntu-latest
permissions:
packages: write
actions: write
steps:
- name: Checkout code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
ref: "${{ inputs.ref }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3
with:
platforms: 'amd64'
- name: Login to registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3
- name: Make cache IDs
id: run_number
run: |
RUN_NUMBER=${{ github.run_number }}
PREV_RN=$(( RUN_NUMBER - 1 ))
NEXT_RN=$(( RUN_NUMBER ))
echo "next_rn=$NEXT_RN" >> $GITHUB_OUTPUT
echo "prev_rn=$PREV_RN" >> $GITHUB_OUTPUT
- name: Restore cache
uses: actions/cache/restore@v4
id: cache-restore
with:
path: |
sccache
key: rust-sccache-amd64-${{ steps.run_number.outputs.prev_rn }}
- name: Delete old cache
run: |
gh extension install actions/gh-actions-cache
set +e
gh actions-cache delete "rust-sccache-amd64-${{ steps.run_number.outputs.prev_rn }}" -R $REPO -B main --confirm
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
- name: Setup cache save
uses: actions/cache@v4
id: cache-restore-save
with:
path: |
sccache
key: rust-sccache-amd64-${{ steps.run_number.outputs.next_rn }}
save-always: true
- name: Inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
with:
cache-map: |
{
"sccache": "/sccache-cache"
}
- name: Build and push
uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1 # v6
with:
push: true
provenance: false
context: "{{defaultContext}}"
tags: "ghcr.io/bradenrayhorn/mise:building-block-amd64-${{ github.sha }}"
platforms: linux/amd64
cache-from: type=registry,ref=ghcr.io/bradenrayhorn/mise:buildcache-amd64
cache-to: type=registry,ref=ghcr.io/bradenrayhorn/mise:buildcache-amd64,mode=max
build-arm64:
name: arm64 image
runs-on: ubuntu-latest
permissions:
packages: write
actions: write
steps:
- name: Checkout code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
ref: "${{ inputs.ref }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3
with:
platforms: 'arm64'
- name: Login to registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3
- name: Make cache IDs
id: run_number
run: |
RUN_NUMBER=${{ github.run_number }}
PREV_RN=$(( RUN_NUMBER - 1 ))
NEXT_RN=$(( RUN_NUMBER ))
echo "next_rn=$NEXT_RN" >> $GITHUB_OUTPUT
echo "prev_rn=$PREV_RN" >> $GITHUB_OUTPUT
- name: Restore cache
uses: actions/cache/restore@v4
id: cache-restore
with:
path: |
sccache
key: rust-sccache-arm64-${{ steps.run_number.outputs.prev_rn }}
- name: Delete old cache
run: |
gh extension install actions/gh-actions-cache
set +e
gh actions-cache delete "rust-sccache-arm64-${{ steps.run_number.outputs.prev_rn }}" -R $REPO -B main --confirm
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
- name: Setup cache save
uses: actions/cache@v4
id: cache-restore-save
with:
path: |
sccache
key: rust-sccache-arm64-${{ steps.run_number.outputs.next_rn }}
save-always: true
- name: Inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
with:
cache-map: |
{
"sccache": "/sccache-cache"
}
- name: Build and push
uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1 # v6
with:
push: true
provenance: false
context: "{{defaultContext}}"
tags: "ghcr.io/bradenrayhorn/mise:building-block-arm64-${{ github.sha }}"
platforms: linux/arm64
cache-from: type=registry,ref=ghcr.io/bradenrayhorn/mise:buildcache-arm64
cache-to: type=registry,ref=ghcr.io/bradenrayhorn/mise:buildcache-arm64,mode=max
retag-next:
name: Push multiarch image
runs-on: ubuntu-latest
permissions:
packages: write
needs: [build-arm64, build-amd64]
steps:
- name: Login to registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3
- name: Retag
run: |
IMAGE=ghcr.io/bradenrayhorn/mise
docker buildx imagetools create \
--tag $IMAGE:next \
--tag $IMAGE:next-${{ github.sha }} \
$IMAGE:building-block-amd64-${{ github.sha }} \
$IMAGE:building-block-arm64-${{ github.sha }}