Disable snapper for testing #33
This file contains 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: 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%2Fbare-metal-iso/versions") | |
echo $TAGS | jq '[.[].metadata.container | { | |
metadata: { | |
name: "bare-metal-os-\(.tags[0])" | |
}, | |
spec: { | |
version: "v\(.tags[0])", | |
type: "container", | |
metadata: { | |
upgradeImage: "ghcr.io/max06/elemental-ubuntu/bare-metal-os:\(.tags[0])", | |
displayName: "Ubuntu 24.04 OS" | |
} | |
} | |
}, { | |
metadata: { | |
name: "bare-metal-iso-\(.tags[0])" | |
}, | |
spec: { | |
version: "v\(.tags[0])", | |
type: "iso", | |
metadata: { | |
uri: "ghcr.io/max06/elemental-ubuntu/bare-metal-iso:\(.tags[0])", | |
displayName: "Ubuntu 24.04 ISO" | |
} | |
} | |
}]' > 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:bare-metal | |
labels: | | |
org.opencontainers.image.description=Metadata image containing list of available elemental-ubuntu images | |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} |