118 lines
3.3 KiB
YAML
118 lines
3.3 KiB
YAML
name: Build act images
|
|
|
|
on:
|
|
schedule:
|
|
- cron: 0 12 */7 * *
|
|
push:
|
|
paths:
|
|
- '.github/workflows/build-ubuntu.yml'
|
|
- 'Dockerfile'
|
|
- 'scripts/**'
|
|
- 'build.sh'
|
|
branches:
|
|
- 'master'
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: git.keligrubb.com
|
|
SLUG: ${{ github.repository_owner }}/ubuntu
|
|
IMAGE_LABEL_OWNER: ${{ github.repository_owner }}
|
|
IMAGE_LABEL_REPO: ${{ github.repository }}
|
|
NODE: '20 24'
|
|
BUILD_REF: ${{ github.sha }}
|
|
SKIP_TEST: false
|
|
LATEST_TAG: 24.04
|
|
|
|
jobs:
|
|
build-act:
|
|
name: Build act ${{ matrix.TAG }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: true
|
|
max-parallel: 4
|
|
matrix:
|
|
TAG:
|
|
- 24.04
|
|
- 22.04
|
|
|
|
steps:
|
|
- uses: https://git.keligrubb.com/actions/checkout@v6
|
|
|
|
- name: Log in to container registry
|
|
uses: https://git.keligrubb.com/actions/docker-login-action@v4
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: actions-runner
|
|
password: ${{ secrets.ACTIONS_REPO_TOKEN }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: https://git.keligrubb.com/actions/docker-setup-buildx-action@v4
|
|
|
|
- name: Compute tags and metadata
|
|
run: |
|
|
PART_TAG=$(date +%Y%m%d)
|
|
TAG_NAME="act-${{ matrix.TAG }}"
|
|
RELEASE_TAG="${{ matrix.TAG }}"
|
|
BUILD_DATE=$(date -u +"%Y-%m-%d %H:%M:%SZ")
|
|
|
|
{
|
|
echo "PART_TAG=$PART_TAG"
|
|
echo "RELEASE_TAG=$RELEASE_TAG"
|
|
echo "BUILD_DATE=$BUILD_DATE"
|
|
echo "ACT_TEST_IMAGE=${{ env.REGISTRY }}/${{ env.SLUG }}:${TAG_NAME}-${PART_TAG}"
|
|
} >>"$GITHUB_ENV"
|
|
|
|
{
|
|
echo "${TAG_NAME}-${PART_TAG}"
|
|
[ "${LATEST_TAG}" = "${{ matrix.TAG }}" ] && echo "act-latest-${PART_TAG}"
|
|
echo "${TAG_NAME}"
|
|
[ "${LATEST_TAG}" = "${{ matrix.TAG }}" ] && echo "act-latest"
|
|
} > .tags
|
|
|
|
- name: Build Docker image
|
|
uses: https://git.keligrubb.com/actions/docker-build-push-action@v7
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
load: true
|
|
tags: act:built
|
|
build-args: |
|
|
NODE_VERSION=${{ env.NODE }}
|
|
DISTRO=ubuntu
|
|
TYPE=act
|
|
RUNNER=root
|
|
BUILD_DATE=${{ env.BUILD_DATE }}
|
|
BUILD_OWNER=${{ env.IMAGE_LABEL_OWNER }}
|
|
BUILD_REPO=${{ env.IMAGE_LABEL_REPO }}
|
|
BUILD_TAG=act-${{ matrix.TAG }}
|
|
BUILD_TAG_VERSION=${{ env.PART_TAG }}
|
|
BUILD_REF=${{ env.BUILD_REF }}
|
|
FROM_IMAGE=buildpack-deps
|
|
FROM_TAG=${{ env.RELEASE_TAG }}
|
|
|
|
- name: Push Docker image (all tags from .tags)
|
|
run: |
|
|
IMAGE="${{ env.REGISTRY }}/${{ env.SLUG }}"
|
|
while read -r tag; do
|
|
docker tag act:built "$IMAGE:$tag"
|
|
docker push "$IMAGE:$tag"
|
|
done < .tags
|
|
|
|
- if: ${{ !env.SKIP_TEST }}
|
|
uses: https://git.keligrubb.com/actions/setup-go@v6
|
|
with:
|
|
go-version: '>=1.21.0'
|
|
|
|
- if: ${{ !env.SKIP_TEST }}
|
|
uses: https://git.keligrubb.com/actions/checkout@v6
|
|
with:
|
|
repository: nektos/act
|
|
path: act
|
|
|
|
- if: ${{ !env.SKIP_TEST }}
|
|
env:
|
|
ACT_TEST_IMAGE: ${{ env.ACT_TEST_IMAGE }}
|
|
run: |
|
|
cd act/
|
|
go test ./...
|