Skip to content

Lerentis/soci-installer

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

soci-installer GitHub Action

This Action installs the SOCI binary during a GitHub Actions run.

Usage

This action currently supports GitHub-provided Linux, runners (self-hosted runners may or may not work). MacOS and Windows binaries are currently not build, therfore this action can not install those.

Add the following entry to your Github workflow YAML file:

uses: lerentis/[email protected]
with:
  soci-release: 'v0.4.0' # optional

Example using a pinned version:

jobs:
  example:
    runs-on: ubuntu-latest

    permissions: {}

    name: Install soci
    steps:
      - name: Install soci
        uses: lerentis/[email protected]
        with:
          soci-release: 'v0.4.0'
      - name: Check install!
        run: soci --version

Example using the default version:

jobs:
  example:
    runs-on: ubuntu-latest

    permissions: {}

    name: Install soci
    steps:
      - name: Install soci
        uses: lerentis/[email protected]
      - name: Check install!
        run: soci --version

This action does not need any GitHub permission to run, however, if your workflow needs to update, create or perform any action against your repository, then you should change the scope of the permission appropriately.

For example, if you are using the gcr.io as your registry to push the images you will need to give the write permission to the packages scope.

Example of a simple workflow:

jobs:
  build-image:
    runs-on: ubuntu-latest

    permissions:
      contents: read
      packages: write

    name: build-image
    steps:
      - uses: actions/[email protected]
        with:
          fetch-depth: 1

      - name: Set up containerd
        uses: crazy-max/ghaction-setup-containerd@v2

      - name: Install soci
        uses: lerentis/[email protected]

      - name: Set up QEMU
        uses: docker/[email protected]

      - name: Set up Docker Buildx
        uses: docker/[email protected]

      - name: Login to GitHub Container Registry
        uses: docker/[email protected]
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Build container images
        uses: docker/[email protected]
        id: build-and-push
        with:
          platforms: linux/amd64,linux/arm/v7,linux/arm64
          push: false
          outputs: type=oci,dest=/tmp/image.tar
          tags:
            - latest

      - name: Import image in containerd
        run: |
          sudo ctr i import --base-name ghcr.io/${{ github.repository }}/test-image --digests --all-platforms /tmp/image.tar

      - name: Push image with containerd
        run: |
          sudo ctr i push --user "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" ghcr.io/${{ github.repository }}/test-image:latest

      - name: Create and push soci index
        run: |
          sudo soci create ghcr.io/${{ github.repository }}/test-image:latest
          sudo soci push --user ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} ghcr.io/${{ github.repository }}/test-image:latest

Optional Inputs

The following optional inputs:

Input Description
soci-release soci version to use instead of the default.
install-dir directory to place the soci binary into instead of the default ($HOME/.soci).