Skip to content

Fix access to CentOS 7 repositories after EOL (#17) #24

Fix access to CentOS 7 repositories after EOL (#17)

Fix access to CentOS 7 repositories after EOL (#17) #24

name: Build and Push Container
on:
push:
schedule:
- cron: "0 4 * * 1"
env:
user: nethserver
image: makerpms
platforms: "linux/amd64"
registry_user: ${{ secrets.registry_user }}
registry_password: ${{ secrets.registry_password }}
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
registry:
- ghcr.io
target:
- makerpms
- buildsys
- devtoolset
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Outputting correct prefix/suffix for each target
id: prefix
run: |
if [[ "${{ matrix.target }}" != "makerpms" ]]; then
echo "::set-output name=prefix::${{ matrix.target }}"
fi
- name: Generate tag list for action event
uses: docker/metadata-action@v4
id: meta
with:
images: |
${{ matrix.registry }}/${{ env.user }}/${{ env.image }}
tags: |
type=ref,event=branch,suffix=-${{ steps.prefix.outputs.prefix }}7,enable=${{ github.ref != format('refs/heads/{0}', 'master') }}
type=raw,value=7,prefix=${{ steps.prefix.outputs.prefix }},enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') && matrix.target == 'makerpms' }}
flavor: |
latest=false
- name: Build ${{ matrix.target }} target
uses: redhat-actions/buildah-build@v2
with:
containerfiles: |
container/Containerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
layers: true
context: container
platforms: ${{ env.platforms }}
extra-args:
--target ${{ matrix.target }}
- name: Push image to Docker HUB
uses: redhat-actions/push-to-registry@v2
if: ${{ matrix.registry == 'docker.io' && env.registry_user != '' }}
with:
tags: ${{ steps.meta.outputs.tags }}
username: ${{ env.registry_user }}
password: ${{ env.registry_password }}
- name: Push image to GHCR
uses: redhat-actions/push-to-registry@v2
# This is done only because there's no simple way to check permissions on token.
# So, if you can view secrets, you will also have write permissions on packages.
if: ${{ matrix.registry == 'ghcr.io' && env.registry_user != '' }}
with:
tags: ${{ steps.meta.outputs.tags }}
username: ${{ github.actor }}
password: ${{ github.token }}