.github/workflows/cicd.yml #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env: | |
DOCKER_BUILDKIT: "1" | |
COMPOSE_DOCKER_CLI_BUILD: "1" | |
BUILDKIT_PROGRESS: "plain" | |
RELEASABLE_REPOS: "^corpusops/" | |
RELEASABLE_BRANCHES: "^(refs/heads/)?(master|main|workflows)$" | |
jobs: | |
r: | |
runs-on: ubuntu-24.04 | |
env: {IMG: "${{matrix.IMG}}", DFILE: "${{matrix.DFILE}}", DPATH: "${{matrix.DPATH}}", | |
IMG_RELEASE: "${{matrix.IMG_RELEASE}}",} | |
steps: | |
- name: Set vars | |
run: |- | |
if ( echo "$GITHUB_REF" | egrep -q "${RELEASABLE_BRANCHES}" ) \ | |
&& ( echo "$GITHUB_REPOSITORY" | egrep -q "${RELEASABLE_REPOS}" ) | |
then releasable=true;else releasable=false;fi | |
echo "releasable=$releasable" >> $GITHUB_OUTPUT | |
echo "silent=$(echo $silent)" >> $GITHUB_OUTPUT | |
id: v | |
- uses: docker/login-action@v2 | |
with: {username: "${{ secrets.DOCKER_HUB_USERNAME }}", password: "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}"} | |
- name: Activate docker experimental | |
run: |- | |
sudo bash -exc "if [ ! -e /etc/docker/daemon.json ];then mkdir /etc/docker||true;echo '{}' > /etc/docker/daemon.json;fi;service docker stop;python -c \"d='/etc/docker/daemon.json';\ | |
import json;c=json.load(open(d));c['experimental']=True;\ | |
open(d, 'w').write(json.dumps(c))\";systemctl restart docker" | |
- uses: actions/checkout@v3 | |
- name: build & release | |
run: set -ex; | |
IMGV=${IMG_RELEASE}; | |
t=${IMG}:${IMGV}; | |
db() { docker build --build-arg BUILDKIT_INLINE_CACHE="1" -t ${3} -f ${1} ${2} "${@:4}"; }; | |
db ${DFILE} ${DPATH} ${t}; | |
if [ "x${{steps.v.outputs.releasable}}" = "xtrue" ];then for i in "";do docker push ${t}${i};done;fi; | |
strategy: | |
max-parallel: 5 | |
fail-fast: false | |
matrix: | |
IMG_RELEASE: | |
- latest | |
IMG: ["corpusops/rsync"] | |
DFILE: ["Dockerfile"] | |
DPATH: ["."] | |
on: | |
push: | |
workflow_dispatch: | |
schedule: [{cron: '1 0 1,3,5,15,17,19 * *'}] |