initial commit
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
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: jasper-agent
|
||||
password: ${{ secrets.JASPER_REPO_TOKEN }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: https://git.keligrubb.com/actions/docker-setup-buildx-action@v4
|
||||
|
||||
- name: Compute tags and metadata
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||
PART_TAG=$(date +%Y%m%d)
|
||||
else
|
||||
PART_TAG=dev
|
||||
fi
|
||||
echo "PART_TAG=$PART_TAG" >> "$GITHUB_ENV"
|
||||
|
||||
if [ "${LATEST_TAG}" = "${{ matrix.TAG }}" ]; then
|
||||
RELEASE_TAG=$(lsb_release -rs)
|
||||
else
|
||||
RELEASE_TAG="${{ matrix.TAG }}"
|
||||
fi
|
||||
echo "RELEASE_TAG=$RELEASE_TAG" >> "$GITHUB_ENV"
|
||||
|
||||
BUILD_DATE=$(date -u +"%Y-%m-%d %H:%M:%SZ")
|
||||
echo "BUILD_DATE=$BUILD_DATE" >> "$GITHUB_ENV"
|
||||
|
||||
TAG_NAME="act-${{ matrix.TAG }}"
|
||||
{
|
||||
echo "${TAG_NAME}-${PART_TAG}"
|
||||
if [ "${LATEST_TAG}" = "${{ matrix.TAG }}" ]; then
|
||||
echo "act-latest-${PART_TAG}"
|
||||
fi
|
||||
echo "${TAG_NAME}"
|
||||
if [ "${LATEST_TAG}" = "${{ matrix.TAG }}" ]; then
|
||||
echo "act-latest"
|
||||
fi
|
||||
} > .tags
|
||||
|
||||
echo "ACT_TEST_IMAGE=${{ env.REGISTRY }}/${{ env.SLUG }}:${TAG_NAME}-${PART_TAG}" >> "$GITHUB_ENV"
|
||||
|
||||
- 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 ./...
|
||||
@@ -0,0 +1,34 @@
|
||||
name: Lint Docker files and shell scripts
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.gitea/workflows/**'
|
||||
- 'Dockerfile'
|
||||
- 'scripts/**'
|
||||
- 'build.sh'
|
||||
|
||||
jobs:
|
||||
lint-dockerfile:
|
||||
name: Lint Dockerfile with hadolint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: https://git.keligrubb.com/actions/checkout@v6
|
||||
- name: Run hadolint
|
||||
uses: hadolint/hadolint-action@v3
|
||||
with:
|
||||
dockerfile: Dockerfile
|
||||
|
||||
lint-shell-scripts:
|
||||
name: Lint shell scripts with shellcheck
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: https://git.keligrubb.com/actions/checkout@v6
|
||||
- name: Install shellcheck
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y shellcheck
|
||||
- name: Run shellcheck
|
||||
run: |
|
||||
find . -name '*.sh' -print0 | xargs -0 -n1 shellcheck
|
||||
|
||||
Reference in New Issue
Block a user