Skip to content

Merge pull request #1 from max06/renovate/configure #11

Merge pull request #1 from max06/renovate/configure

Merge pull request #1 from max06/renovate/configure #11

Workflow file for this run

name: Docker Build and Publish
on:
push:
branches: [main]
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=sha,format=short
type=raw,value=latest
type=semver,pattern={{version}},event=tag
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Query available images
id: query-images
run: |
# Query GHCR API for image tags
TAGS=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/user/packages/container/elemental-ubuntu/versions")
echo $TAGS
echo $TAGS | jq '[.[].metadata.container | {
metadata: {
name: "elemental-ubuntu-\(.tags[0])"
},
spec: {
version: "v\(.tags[0])",
type: "iso",
metadata: {
upgradeImage: "ghcr.io/max06/elemental-ubuntu:\(.tags[0])",
displayName: "Elemental Ubuntu - \(.tags[0])"
}
}
}]' > metadata.json
# Create temporary Dockerfile
cat <<EOF > Dockerfile
FROM busybox
COPY metadata.json /channel.json
USER 10010:10010
ENTRYPOINT ["cp"]
CMD ["/channel.json", "/data/output"]
EOF
- name: Build and push metadata image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/max06/elemental-ubuntu-channel:latest
labels: |
org.opencontainers.image.description=Metadata image containing list of available elemental-ubuntu images
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}