Skip to content

dfreilich/pack-action

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

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

test

Pack Github Action

This Github Action uses the Pack CLI (a product of the Cloud Native Buildpacks project) to build applications and associated artifacts, without a Dockerfile. For more about pack concepts, see the pack docs. For pack usage specific documentation, see the Pack CLI docs.

In v2, login is no longer included in the action. Instead, users should use the docker/login-action in another step beforehand, and this action should pick up those credentials

In v2, you must use the direct path within the directory, without the /github/workspace/ preface

Usage

Help

jobs:
  test:
    runs-on: linux
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Pack Help
        uses: dfreilich/pack-action@v2
        with:
          args: help

Local Build

jobs:
  local_build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Pack Build
        uses: dfreilich/pack-action@v2
        with:
          args: 'build test_img --builder paketobuildpacks/builder:full'

For a list of suggested builders, run:

$ pack suggest-builders

on your local machine.

Remote Build

  dockerhub_remote_build:
    runs-on: ubuntu-latest
    env:
      USERNAME: '<SOMETHING>'
      IMG_NAME: '<SOME_IMG>'
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Set App Name
        run: 'echo "IMG_NAME=$(echo ${USERNAME})/$(echo ${IMG_NAME})" >> $GITHUB_ENV'
      - name: login
        uses: docker/login-action@v1
        with:
          username: ${{ env.USERNAME }}
          password: ${{ secrets.DOCKER_TOKEN }}
      - name: Pack Remote Build
        uses: dfreilich/pack-action@v2
        with:
          args: 'build ${{ env.IMG_NAME }} --builder paketobuildpacks/builder:full --publish'

If you are publishing to a registry that is not Docker Hub, you can also add in an optional registry argument:

  github_registry_remote_build:
    runs-on: ubuntu-latest
    env:
      USERNAME: '<NAME>'
      IMG_NAME: '<IMAGE>'
      REGISTRY: '<REGISTRY: ex. ghcr.io>'
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Set App Name
        run: 'echo "IMG_NAME=$(echo ${REGISTRY})/$(echo ${USERNAME})/$(echo ${IMG_NAME})" >> $GITHUB_ENV'
      - id: login
        uses: docker/login-action@v1
        with:
          username: ${{ env.USERNAME }}
          password: ${{ secrets.GH_PACKAGES_PAT }}
          registry: ${{ env.REGISTRY }}
      - name: Pack Remote Build
        uses: dfreilich/pack-action@v2
        with:
          args: 'build ${{ env.IMG_NAME }} --builder ${{ env.BUILDER }} --publish'

More Examples

For more examples, see the test workflows.

Inputs

args

Required The arguments to pass into pack. A list of available commands can be found here.

How can I help ?

Any contribution is welcome! The most basic way to show your support is to star 🌟 the project, or to raise issues 💬.

License

Apache. See LICENSE for more details.