Build by github actions (#70)
* BUILD_IMAGE from environment vairables has precedence. * add workflow. * trigger actions.
This commit is contained in:
parent
8612286c98
commit
1800d077d8
76
.github/workflows/build.yml
vendored
Normal file
76
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
name: "CI for builds"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ dev ]
|
||||||
|
#
|
||||||
|
# Run this action periodically to keep browsers up-to-date
|
||||||
|
# even if there is no activity in this repo.
|
||||||
|
#
|
||||||
|
schedule:
|
||||||
|
- cron: "43 2 * * 1"
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKER_IMAGE: m1k1o/neko
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-base:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
#
|
||||||
|
# do not run on forks
|
||||||
|
#
|
||||||
|
if: github.repository_owner == 'm1k1o'
|
||||||
|
steps:
|
||||||
|
- name: Check Out Repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
run: |
|
||||||
|
docker login --username "${DOCKER_USERNAME}" --password-stdin "${DOCKER_REGISTRY}" <<< "${DOCKER_TOKEN}"
|
||||||
|
env:
|
||||||
|
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
|
||||||
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build base
|
||||||
|
run: |
|
||||||
|
BUILD_IMAGE=${DOCKER_IMAGE} .m1k1o/build ${DOCKER_TAG}
|
||||||
|
docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
|
||||||
|
env:
|
||||||
|
DOCKER_TAG: base
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
#
|
||||||
|
# do not run on forks
|
||||||
|
#
|
||||||
|
if: github.repository_owner == 'm1k1o'
|
||||||
|
needs: [ build-base ]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
tags: [ firefox, chromium, google-chrome, ungoogled-chromium, tor-browser, vncviewer, vlc, xfce ]
|
||||||
|
env:
|
||||||
|
DOCKER_TAG: ${{ matrix.tags }}
|
||||||
|
steps:
|
||||||
|
- name: Check Out Repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
run: |
|
||||||
|
docker login --username "${DOCKER_USERNAME}" --password-stdin "${DOCKER_REGISTRY}" <<< "${DOCKER_TOKEN}"
|
||||||
|
env:
|
||||||
|
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
|
||||||
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build container
|
||||||
|
run: |
|
||||||
|
BUILD_IMAGE=${DOCKER_IMAGE} .m1k1o/build ${DOCKER_TAG}
|
||||||
|
docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
|
||||||
|
|
||||||
|
- name: Push latest tag
|
||||||
|
if: ${{ matrix.tags == 'firefox' }}
|
||||||
|
run: |
|
||||||
|
docker pull ${DOCKER_IMAGE}:${DOCKER_TAG}
|
||||||
|
docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:latest
|
||||||
|
docker push ${DOCKER_IMAGE}:latest
|
13
.m1k1o/build
13
.m1k1o/build
@ -3,6 +3,12 @@ cd "$(dirname "$0")"
|
|||||||
|
|
||||||
BASE="${PWD}/../"
|
BASE="${PWD}/../"
|
||||||
|
|
||||||
|
# BUILD_IMAGE from environment vairables has precedence
|
||||||
|
if [ ! -z "${BUILD_IMAGE}" ]
|
||||||
|
then
|
||||||
|
ENV_BUILD_IMAGE="${BUILD_IMAGE}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f ".env.default" ]
|
if [ -f ".env.default" ]
|
||||||
then
|
then
|
||||||
export $(cat .env.default | sed 's/#.*//g' | xargs)
|
export $(cat .env.default | sed 's/#.*//g' | xargs)
|
||||||
@ -13,6 +19,13 @@ then
|
|||||||
export $(cat .env | sed 's/#.*//g' | xargs)
|
export $(cat .env | sed 's/#.*//g' | xargs)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# BUILD_IMAGE from environment vairables has precedence
|
||||||
|
if [ ! -z "${ENV_BUILD_IMAGE}" ]
|
||||||
|
then
|
||||||
|
BUILD_IMAGE="${ENV_BUILD_IMAGE}"
|
||||||
|
unset ENV_BUILD_IMAGE
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "${1}" ] && [ ! -z "${SERVER_TAG}" ]
|
if [ -z "${1}" ] && [ ! -z "${SERVER_TAG}" ]
|
||||||
then
|
then
|
||||||
./build base
|
./build base
|
||||||
|
Reference in New Issue
Block a user