Skip to content

Build and Push Images #78

Build and Push Images

Build and Push Images #78

name: Build and Push Images
on:
push:
branches: [ "main" ]
schedule:
- cron: '0 15 * * 6'
jobs:
build-images:
runs-on: ubuntu-latest
strategy:
matrix:
desktop: [
'silverblue',
'hyprland',
'dev-toolbox'
]
steps:
- name: Checkout Github Action
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
run: 'echo ${{secrets.GITHUB_TOKEN}} | docker login ghcr.io -u ${{github.actor}} --password-stdin'
- uses: sigstore/[email protected]
- name: Build and Push Images
env:
COSIGN_EXPERIMENTAL: false
COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }}
run: |
cd ./${{matrix.desktop }}
build_date=$(date +%s)
targets=$(sed -n 's/^FROM[[:space:]]\+[^ ]\+[[:space:]]\+AS[[:space:]]\+\([^ ]\+\)$/\1/p' Containerfile)
for target in $targets; do
image="ghcr.io/andyrusiecki/$target"
docker build . --file Containerfile --target $target --tag ${image}:${build_date}
docker tag ${image}:${build_date} ${image}:latest
docker push --all-tags ${image}
digest=$(docker inspect --format='{{index .RepoDigests 0}}' $image)
cosign sign -y --key env://COSIGN_PRIVATE_KEY ${digest}
done