Files
gitea-debian-runner/.github/workflows/build-ubuntu.yml
T
2021-08-17 20:10:52 +02:00

270 lines
7.9 KiB
YAML

name: Build ubuntu images
on:
schedule:
- cron: 0 12 */7 * *
push:
paths:
- '.github/workflows/build-ubuntu.yml'
- 'linux/ubuntu/**'
branches:
- 'master'
pull_request:
paths:
- '.github/workflows/build-ubuntu.yml'
- 'linux/ubuntu/**'
workflow_dispatch:
env:
SLUG: ${{ github.repository_owner }}/ubuntu
DISTRO: ubuntu
NODE: '14'
BUILD_REF: ${{ github.sha }}
SKIP_TEST: false
defaults:
run:
shell: sh
jobs:
build-base:
runs-on: ubuntu-latest
strategy:
fail-fast: true
max-parallel: 4
matrix:
include:
- TAG: latest
PLATFORMS: linux/amd64,linux/arm64
- TAG: 20.04
PLATFORMS: linux/amd64,linux/arm64
- TAG: 18.04
PLATFORMS: linux/amd64
- TAG: 16.04
PLATFORMS: linux/amd64
env:
PLATFORMS: ${{ matrix.PLATFORMS }}
steps:
- name: Login to GitHub Container Registry
if: ${{ github.repository_owner == github.actor }}
id: ghcr
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Quay
if: ${{ github.repository_owner == github.actor }}
id: quay
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Login to Docker Hub
if: ${{ github.repository_owner == github.actor }}
id: dckr
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Print tag
run: |
if ${{ github.event_name == 'pull_request' }} && ${{ !env.ACT }} ; then
echo "PART_TAG=PR-${{ github.event.number }}" >> $GITHUB_ENV
elif ${{ !env.ACT }} ; then
echo "PART_TAG=$(date +%Y%m%d)" >> $GITHUB_ENV
else
echo "PART_TAG=dev" >> $GITHUB_ENV
fi
- name: Set Ubuntu version to RELEASE
run: |
if [ "latest" = "${{ matrix.TAG }}" ]; then
echo "RELEASE_TAG=$(lsb_release -rs)" >> $GITHUB_ENV
else
echo "RELEASE_TAG=${{ matrix.TAG }}" >> $GITHUB_ENV
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- run: |
docker buildx create \
--use \
--name image-builder \
--buildkitd-flags '--allow-insecure-entitlement network.host' \
--driver docker-container \
--driver-opt "env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000" \
--platform "${{ env.PLATFORMS }}"
- uses: actions/checkout@v2
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
run: ./build.sh
env:
RUNNER: root
TAG: act-${{ matrix.TAG }}-${{ env.PART_TAG }}
TYPE: act
FROM_IMAGE: buildpack-deps
FROM_TAG: ${{ env.RELEASE_TAG }}
BUILD_TAG_VERSION: ${{ env.PART_TAG }}
BUILD_TAG: act-${{ matrix.TAG }}
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
run: ./build.sh
env:
RUNNER: runner
TAG: runner-${{ matrix.TAG }}-${{ env.PART_TAG }}
TYPE: runner
FROM_IMAGE: ghcr.io/${{ env.SLUG }}
FROM_TAG: act-${{ matrix.TAG }}-${{ env.PART_TAG }}
BUILD_TAG_VERSION: ${{ env.PART_TAG }}
BUILD_TAG: runner-${{ matrix.TAG }}
- uses: actions/setup-go@v2
with:
go-version: 1.16
- uses: actions/checkout@v2
with:
repository: nektos/act
path: act
- if: ${{ !env.SKIP_TEST }}
env:
ACT_TEST_IMAGE: ghcr.io/${{ env.SLUG }}:act-${{ matrix.TAG }}-${{ env.PART_TAG }}
run: |
cd act/
go test ./...
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
if: ${{ ( github.event_name != 'pull_request' && !env.ACT ) }}
run: ./build.sh
env:
RUNNER: root
TAG: act-${{ matrix.TAG }}
TYPE: act
FROM_IMAGE: buildpack-deps
FROM_TAG: ${{ env.RELEASE_TAG }}
BUILD_TAG_VERSION: ${{ env.PART_TAG }}
BUILD_TAG: act-${{ matrix.TAG }}
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
if: ${{ ( github.event_name != 'pull_request' && !env.ACT ) }}
run: ./build.sh
env:
RUNNER: runner
TAG: runner-${{ matrix.TAG }}
TYPE: runner
FROM_IMAGE: ghcr.io/${{ env.SLUG }}
FROM_TAG: act-${{ matrix.TAG }}
BUILD_TAG_VERSION: ${{ env.PART_TAG }}
BUILD_TAG: runner-${{ matrix.TAG }}
build-flavours:
runs-on: ubuntu-latest
needs: [build-base]
strategy:
fail-fast: false
max-parallel: 2
matrix:
include:
- TAG: latest
TYPE: js
PLATFORMS: linux/amd64,linux/arm64
- TAG: latest
TYPE: pwsh
PLATFORMS: linux/amd64,linux/arm64
- TAG: 20.04
TYPE: js
PLATFORMS: linux/amd64,linux/arm64
- TAG: 20.04
TYPE: pwsh
PLATFORMS: linux/amd64,linux/arm64
- TAG: 18.04
TYPE: js
PLATFORMS: linux/amd64
- TAG: 18.04
TYPE: pwsh
PLATFORMS: linux/amd64
env:
PLATFORMS: ${{ matrix.PLATFORMS }}
BUILD_TAG: ${{ matrix.TYPE }}-${{ matrix.TAG }}
TAG: ${{ matrix.TYPE }}-${{ matrix.TAG }}
TYPE: ${{ matrix.TYPE }}
RUNNER: root
steps:
- name: Login to GitHub Container Registry
id: ghcr
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Quay
id: quay
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Login to Docker Hub
id: dckr
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Print tag
run: |
if ${{ github.event_name == 'pull_request' }} && ${{ !env.ACT }} ; then
echo "PART_TAG=PR-${{ github.event.number }}" >> $GITHUB_ENV
elif ${{ !env.ACT }} ; then
echo "PART_TAG=$(date +%Y%m%d)" >> $GITHUB_ENV
else
echo "PART_TAG=dev" >> $GITHUB_ENV
fi
- name: Set Ubuntu version to RELEASE
run: |
if [ "latest" = "${{ matrix.TAG }}" ]; then
echo "RELEASE_TAG=$(lsb_release -rs)" >> $GITHUB_ENV
else
echo "RELEASE_TAG=${{ matrix.TAG }}" >> $GITHUB_ENV
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- run: |
docker buildx create \
--use \
--name image-builder \
--buildkitd-flags '--allow-insecure-entitlement network.host' \
--driver docker-container \
--driver-opt "env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000" \
--platform "${{ env.PLATFORMS }}"
- uses: actions/checkout@v2
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
run: ./build.sh
env:
TAG: ${{ env.TAG }}-${{ env.PART_TAG }}
FROM_IMAGE: ghcr.io/${{ env.SLUG }}
FROM_TAG: act-${{ matrix.TAG }}-${{ env.PART_TAG }}
BUILD_TAG_VERSION: ${{ env.PART_TAG }}
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
run: ./build.sh
if: ${{ ( github.event_name != 'pull_request' && !env.ACT ) }}
env:
FROM_IMAGE: ghcr.io/${{ env.SLUG }}
FROM_TAG: act-${{ matrix.TAG }}-${{ env.PART_TAG }}
BUILD_TAG_VERSION: ${{ env.PART_TAG }}