refactor: move to sh scripts (#17)

This commit is contained in:
Ryan (hackercat)
2021-07-21 08:43:59 +00:00
committed by GitHub
parent fc531ee59c
commit c84f165490
27 changed files with 526 additions and 651 deletions
-166
View File
@@ -1,166 +0,0 @@
name: Build alpine images
on:
#schedule:
# - cron: 0 12 */7 * *
#push:
# paths:
# - '.github/workflows/build-alpine.yml'
# - 'linux/alpine/**'
# branches:
# - 'master'
#pull_request:
# paths:
# - '.github/workflows/build-alpine.yml'
# - 'linux/alpine/**'
workflow_dispatch:
env:
SLUG: ${{ github.repository_owner }}/alpine
IMAGE: alpine
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
jobs:
build-alpine:
runs-on: ubuntu-latest
environment: Images
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
id: print-tag
run: |
if [ ${{ github.event_name }} == 'pull_request'}} && ${{ !env.ACT }} ]; then
echo "::set-output name=tag::PR-${{ github.event.number }}"
elif [ "${ACT}" == "true" ]; then
echo "::set-output name=tag::dev"
else
echo "::set-output name=tag::$(date +%Y%m%d)"
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- uses: actions/checkout@v2
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
uses: docker/build-push-action@v2
env:
TAG: act-${{ steps.print-tag.outputs.tag }}
with:
context: .
push: true
file: ./linux/${{ env.IMAGE }}/act/Dockerfile
platforms: ${{ env.PLATFORMS }}
tags: |
ghcr.io/${{ env.SLUG }}:${{ env.TAG }}
quay.io/${{ env.SLUG }}:${{ env.TAG }}
docker.io/${{ env.SLUG }}:${{ env.TAG }}
build-args: |
DISTRO=${{ env.IMAGE }}
BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }}
BUILD_TAG=act
BUILD_REF=${{ github.sha }}
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
uses: docker/build-push-action@v2
env:
TAG: runner-${{ steps.print-tag.outputs.tag }}
with:
context: .
push: true
file: ./linux/${{ env.IMAGE }}/runner/Dockerfile
platforms: ${{ env.PLATFORMS }}
tags: |
ghcr.io/${{ env.SLUG }}:${{ env.TAG }}
quay.io/${{ env.SLUG }}:${{ env.TAG }}
docker.io/${{ env.SLUG }}:${{ env.TAG }}
build-args: |
IMAGE=ghcr.io/${{ env.SLUG }}
DISTRO=${{ env.IMAGE }}
TAG=act-${{ steps.print-tag.outputs.tag }}
BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }}
BUILD_TAG=runner
BUILD_REF=${{ github.sha }}
- uses: actions/setup-go@v2
with:
go-version: 1.16
- uses: actions/checkout@v2
with:
ref: cat/fix/change-image
repository: catthehacker/act-fork
path: act
- env:
ACT_TEST_IMAGE: ghcr.io/${{ env.SLUG }}:act-${{ steps.print-tag.outputs.tag }}
ACT_REPOSITORY: catthehacker/act-fork
ACT_OWNER: catthehacker
run: |
cd act/
go test ./...
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
uses: docker/build-push-action@v2
env:
TAG: act
with:
context: .
push: ${{ ( github.event_name != 'pull_request' && !env.ACT ) }}
file: ./linux/${{ env.IMAGE }}/act/Dockerfile
platforms: ${{ env.PLATFORMS }}
tags: |
ghcr.io/${{ env.SLUG }}:${{ env.TAG }}
quay.io/${{ env.SLUG }}:${{ env.TAG }}
docker.io/${{ env.SLUG }}:${{ env.TAG }}
build-args: |
DISTRO=${{ env.IMAGE }}
BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }}
BUILD_TAG=${{ env.TAG }}
BUILD_REF=${{ github.sha }}
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
uses: docker/build-push-action@v2
env:
TAG: runner
with:
context: .
push: ${{ ( github.event_name != 'pull_request' && !env.ACT ) }}
file: ./linux/${{ env.IMAGE }}/runner/Dockerfile
platforms: ${{ env.PLATFORMS }}
tags: |
ghcr.io/${{ env.SLUG }}:${{ env.TAG }}
quay.io/${{ env.SLUG }}:${{ env.TAG }}
docker.io/${{ env.SLUG }}:${{ env.TAG }}
build-args: |
IMAGE=ghcr.io/${{ env.SLUG }}
DISTRO=${{ env.IMAGE }}
TAG=act-${{ steps.print-tag.outputs.tag }}
BUILD_TAG_VERSION=${{ steps.print-tag.outputs.tag }}
BUILD_TAG=${{ env.TAG }}
BUILD_REF=${{ github.sha }}
+33 -26
View File
@@ -17,11 +17,11 @@ on:
env:
SLUG: ${{ github.repository_owner }}/ubuntu
IMAGE: ubuntu
DISTRO: ubuntu
PLATFORMS: linux/amd64
NODE: '12'
NODE: '14'
BUILD_REF: ${{ github.sha }}
SKIP_TEST: true
SKIP_TEST: false
defaults:
run:
@@ -30,9 +30,6 @@ defaults:
jobs:
build-base:
runs-on: ubuntu-latest
environment: Images
env:
PLATFORMS: linux/amd64,linux/arm64
strategy:
fail-fast: true
max-parallel: 4
@@ -83,28 +80,34 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-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 }}
DISTRO: ${{ env.IMAGE }}
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
DISTRO: ${{ env.IMAGE }}
FROM_IMAGE: ghcr.io/${{ env.SLUG }}
FROM_TAG: act-${{ matrix.TAG }}-${{ env.PART_TAG }}
BUILD_TAG_VERSION: ${{ env.PART_TAG }}
@@ -130,11 +133,11 @@ jobs:
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 }}
DISTRO: ${{ env.IMAGE }}
BUILD_TAG_VERSION: ${{ env.PART_TAG }}
BUILD_TAG: act-${{ matrix.TAG }}
@@ -142,9 +145,9 @@ jobs:
if: ${{ ( github.event_name != 'pull_request' && !env.ACT ) }}
run: ./build.sh
env:
RUNNER: runner
TAG: runner-${{ matrix.TAG }}
TYPE: runner
DISTRO: ${{ env.IMAGE }}
FROM_IMAGE: ghcr.io/${{ env.SLUG }}
FROM_TAG: act-${{ matrix.TAG }}
BUILD_TAG_VERSION: ${{ env.PART_TAG }}
@@ -153,11 +156,16 @@ jobs:
runs-on: ubuntu-latest
needs: [build-base]
strategy:
fail-fast: true
max-parallel: 4
fail-fast: false
max-parallel: 2
matrix:
TAG: [latest, 20.04, 18.04, 16.04]
TYPE: [js, rust]
TAG: [latest, 20.04, 18.04]
TYPE: [js, pwsh]
env:
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
@@ -203,30 +211,29 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-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: ${{ matrix.TYPE }}-${{ matrix.TAG }}-${{ env.PART_TAG }}
TYPE: ${{ matrix.TYPE }}
TAG: ${{ env.TAG }}-${{ env.PART_TAG }}
FROM_IMAGE: ghcr.io/${{ env.SLUG }}
FROM_TAG: act-${{ matrix.TAG }}-${{ env.PART_TAG }}
DISTRO: ${{ env.IMAGE }}
BUILD_TAG_VERSION: ${{ env.PART_TAG }}
BUILD_TAG: ${{ matrix.TYPE }}-${{ matrix.TAG }}
- name: Build and push ${{ env.SLUG }}:${{ env.TAG }}
run: ./build.sh
if: ${{ ( github.event_name != 'pull_request' && !env.ACT ) }}
env:
TAG: ${{ matrix.TYPE }}-${{ matrix.TAG }}
TYPE: ${{ matrix.TYPE }}
FROM_IMAGE: ghcr.io/${{ env.SLUG }}
FROM_TAG: act-${{ matrix.TAG }}-${{ env.PART_TAG }}
DISTRO: ${{ env.IMAGE }}
BUILD_TAG_VERSION: ${{ env.PART_TAG }}
BUILD_TAG: ${{ matrix.TYPE }}-${{ matrix.TAG }}