iosifnicolae2 / package-action

:octocat: Builds and pushes Docker images in to GitHub Package Registry.

Home Page:https://github.com/marketplace/actions/docker-package-registry

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maintained by Craftech.io Github Package Registry

GitHub Docker Action

Build and publish your repository as a Docker image and push it to GitHub Package Registry in one easy step.

Inputs variables

With Parameter Required/Optional Description
access_token Required GitHub Token for the user. Must have write permissions for packages. Recommended set up would be to use the provided GitHub Token for your repository; ${{ secrets.GITHUB_TOKEN }}.
context Optional Where should GitHub Docker find the Dockerfile? This is a path relative to the repository root. Defaults to ., meaning it will look for a Dockerfile in the root of the repository.
tags Optional The desired name for the image tag. Defaults to current is the commit SHA that triggered the workflow. For example, ffac537e6cbbf934b08745a378932722df287a53..
dockerfile Optional The desired name for the Dockerfile. Defaults to current Dockerfile name.
image_name Optional The desired name for the image. Defaults to current repository name.
build_args Optional Any additional build arguments to use when building the image.
username Optional GitHub user to publish the image on behalf of. Defaults to the user who triggered the action to run.
repository Optional The repository to push the image to. Defaults to current repository. Must be specified in format user/repo. Please specify the secret for Personal Access Token (PAT)

Outputs variables

With Parameter Required/Optional Description
imageURL Optional The full URL of the image. See documentation

Simple usage

- name: Publish Image
  uses: craftech-io/package-action@v3.1.0
  with:
    tags: latest
    access_token: ${{ secrets.GITHUB_TOKEN }}

Use with multiples tags

with:
  tags: |
    latest
    anothertag

Use with multiples ARGs

with:
  build_args: |
    THISISARG1=test
    THISISARG2=test

Use with outputs variables

- name: Publish Image
  uses: craftech-io/package-action@v3.1.0
  id: url-GPR 
  with:
    tags: latest
    access_token: ${{ secrets.GITHUB_TOKEN }}

- name: output
  run: echo ${{ steps.url-GPR.outputs.imageURL }}    

Use with Dockerfile name

- name: Publish Image
  uses: craftech-io/package-action@v3.1.0
  id: url-GPR 
  with:
    tags: latest
    dockerfile: Dockerfile.base
    access_token: ${{ secrets.GITHUB_TOKEN }}  

Push a different repository

- name: Publish Image
  uses: craftech-io/package-action@v3.1.0
  id: url-GPR 
  with:
    tags: latest
    repository: my-user/my-repo
    access_token: ${{ secrets.TOKEN_PAT }}
  • ${{ github.token }} is scoped to the current repository, so if you want to push a different repository that is private you will need to provide your own PAT.

About

:octocat: Builds and pushes Docker images in to GitHub Package Registry.

https://github.com/marketplace/actions/docker-package-registry

License:MIT License


Languages

Language:JavaScript 94.2%Language:Dockerfile 5.8%