Files
gitea-debian-runner/.github/workflows/build-alpine.yml
T
2021-06-15 00:30:46 +02:00

167 lines
5.1 KiB
YAML

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 }}