Install jc from the deb file #15
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
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
find-subfolders: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install jc | |
run: | | |
curl https://github.com/kellyjonbrazil/jc/releases/download/v1.25.2/jc_1.25.2-1_amd64.deb -o jc.deb | |
sudo dpkg -i jc.deb | |
# List the two subdirectories under the src directory, and turn it into a json array for easier parsing in the next step. | |
# Like: ["./fabric-runtime/1.1","./fabric-runtime/1.2"] | |
- name: Find subfolders to build | |
run: | | |
SUBFOLDERS=$(cd src && find . -mindepth 2 -maxdepth 2 -type d | jc --find -r) | |
echo "Found subfolders: $SUBFOLDERS" | |
echo "SUBFOLDERS=$SUBFOLDERS" >> $GITHUB_ENV | |
outputs: | |
subfolders: ${{ env.SUBFOLDERS }} | |
build: | |
runs-on: ubuntu-latest | |
needs: find-subfolders | |
strategy: | |
# Don't fail all the builds if one fails | |
fail-fast: false | |
matrix: | |
subfolder: ${{ fromJson(needs.find-subfolders.outputs.subfolders) }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Parse out the image name and tag | |
run: | | |
echo "Parsing subfolder: ${{ matrix.subfolder }}" | |
# The first part is the image name | |
IMAGE_NAME=$(echo ${{ matrix.subfolder }} | cut -d / -f 2) | |
echo "The image name is: $IMAGE_NAME" | |
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV | |
# And the second part is the image tag | |
IMAGE_TAG=$(echo ${{ matrix.subfolder }} | cut -d / -f 3) | |
echo "The image tag is: $IMAGE_TAG" | |
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV | |
- name: Build images | |
uses: devcontainers/[email protected] | |
# Options: https://github.com/devcontainers/ci/blob/main/action.yml | |
with: | |
imageName: ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME }} | |
cacheFrom: ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME }} | |
imageTag: ${{ env.IMAGE_TAG }} | |
push: always | |
subFolder: src/${{ matrix.subfolder }} |