Completion Improvement #205
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
name: pull-request container-image | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- opened | |
- synchronize | |
concurrency: | |
group: image-pr-${{ github.ref }} | |
cancel-in-progress: true | |
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 }}:pr-${{ github.event.number }} \ | |
--file cmd/${{ matrix.name }}/Dockerfile . | |
docker push ghcr.io/slankdev/vtyang-${{ matrix.name }}:pr-${{ github.event.number }} | |
env: | |
BUILDKIT: 1 |