Skip to content

Merge pull request #18 from slankdev/work #16

Merge pull request #18 from slankdev/work

Merge pull request #18 from slankdev/work #16

Workflow file for this run

name: main-branch container-image
on:
push:
branches:
- main
jobs:
preprocess:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.setmatrix.outputs.result }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/github-script@v6
id: setmatrix
with:
result-encoding: string
script: |
const fs = require("fs");
file = fs.readFileSync('./.github/workflows/editme.json', "utf8");
return JSON.stringify(JSON.parse(file).containerImages);
docker-build:
name: ${{ matrix.name }}
needs: preprocess
runs-on: ubuntu-latest
strategy:
matrix:
include: ${{fromJson(needs.preprocess.outputs.matrix)}}
steps:
- name: clone repo
uses: actions/checkout@v2
- name: login ghcr
id: login_docker
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: push with branch name
id: run_docker_push_with_branch_name
run: |
docker build \
--build-arg GIT_SHA=$(git rev-parse HEAD) \
--build-arg GIT_BRANCH=$(git symbolic-ref HEAD | sed -e 's#refs/heads/##g') \
--build-arg GIT_TAG=none \
--build-arg BUILD_DATE=$(date '+%Y/%m/%d-%H:%M:%S-%Z') \
--tag ghcr.io/slankdev/vtyang-${{ matrix.name }}:branch-main \
--file cmd/${{ matrix.name }}/Dockerfile .
docker push ghcr.io/slankdev/vtyang-${{ matrix.name }}:branch-main
env:
BUILDKIT: 1