Skip to content

Another one

Another one #19

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: Build base os
run: make build-base-os ELEMENTAL_BUILD=${{ github.run_number }}
- name: Build bare-metal os
run: make build-bare-metal-os ELEMENTAL_BUILD=${{ github.run_number }}
- name: Build bare-metal iso
run: make build-bare-metal-iso ELEMENTAL_BUILD=${{ github.run_number }}
- name: Debug step
run: echo $GITHUB_RUN_NUMBER
- 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: "container",
metadata: {
upgradeImage: "ghcr.io/max06/elemental-ubuntu:\(.tags[0])",
displayName: "Elemental Ubuntu - \(.tags[0])"
}
}
}, {
metadata: {
name: "elemental-ubuntu-\(.tags[0])"
},
spec: {
version: "v\(.tags[0])",
type: "iso",
metadata: {
uri: "ghcr.io/max06/elemental-ubuntu:\(.tags[0])",
displayName: "Elemental Ubuntu ISO - \(.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 }}