-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (42 loc) · 1.72 KB
/
build-and-push.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Build container images
on:
push:
branches:
- main
schedule:
# Basically picked at random to try and be a low-load time for GitHub Actions
- cron: '20 3 * * 0'
workflow_dispatch:
jobs:
get-ubuntu-versions:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.versions.outputs.versions }}
steps:
- name: Query Launchpad API for active and supported Ubuntu versions
id: versions
# This command actually grabs Ubuntu ESM-supported releases too, but the Launchpad API doesn't give a way to differentiate these out so who cares
run: curl https://api.launchpad.net/devel/ubuntu/series | jq '.entries[] | select(.supported == true and .active == true) | .version' | tr '\n' ' ' | sed -e 's/^/versions=[/' -e 's/ $/]/' -e 's/ /, /g' >> "$GITHUB_OUTPUT"
build-push-images:
runs-on: ubuntu-latest
needs: get-ubuntu-versions
strategy:
matrix:
version: ${{ fromJSON(needs.get-ubuntu-versions.outputs.versions) }}
env:
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
steps:
- name: Log in to GitHub Container Registry
uses: redhat-actions/podman-login@v1
with:
username: ${{ github.actor }}
password: ${{ github.token }}
# TODO use {{ github.repository_owner }} when https://github.com/redhat-actions/podman-login/issues/44 is fixed
registry: ghcr.io/seagl
- name: Checkout Repo
uses: actions/checkout@v1
- name: Build and push container images
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: ./build-and-push.sh ${{ matrix.version }}