{"id":17726682,"url":"https://github.com/sergeysova/docker-publish-action","last_synced_at":"2025-04-01T13:34:11.049Z","repository":{"id":40724705,"uuid":"251626814","full_name":"sergeysova/docker-publish-action","owner":"sergeysova","description":"Use git tag and branch as Docker tags for pushing","archived":false,"fork":false,"pushed_at":"2023-01-05T18:16:04.000Z","size":1463,"stargazers_count":7,"open_issues_count":9,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-14T14:02:32.753Z","etag":null,"topics":["actions","docker","github-actions"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sergeysova.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":"sergeysova","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.buymeacoffee.com/sergeysova","https://vk.com/sovadev"]}},"created_at":"2020-03-31T14:24:37.000Z","updated_at":"2022-08-17T05:24:41.000Z","dependencies_parsed_at":"2023-01-11T17:22:00.108Z","dependency_job_id":null,"html_url":"https://github.com/sergeysova/docker-publish-action","commit_stats":{"total_commits":62,"total_committers":6,"mean_commits":"10.333333333333334","dds":0.4838709677419355,"last_synced_commit":"352dc0edeb9ad522f2106dd6f562ee10e8da9638"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeysova%2Fdocker-publish-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeysova%2Fdocker-publish-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeysova%2Fdocker-publish-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeysova%2Fdocker-publish-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sergeysova","download_url":"https://codeload.github.com/sergeysova/docker-publish-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246604612,"owners_count":20804100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","docker","github-actions"],"created_at":"2024-10-25T17:06:32.565Z","updated_at":"2025-04-01T13:34:10.730Z","avatar_url":"https://github.com/sergeysova.png","language":"JavaScript","funding_links":["https://patreon.com/sergeysova","https://www.buymeacoffee.com/sergeysova","https://vk.com/sovadev"],"categories":[],"sub_categories":[],"readme":"# Docker Publish Action\n\n## Usage\n\n```yaml\nname: Docker Image\n\non: [push]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n\n      - name: Publish to Registry\n        uses: sergeysova/docker-publish-action@master\n        with:\n          image: myDocker/repository\n          username: ${{ secrets.DOCKER_USERNAME }}\n          password: ${{ secrets.DOCKER_PASSWORD }}\n```\n\nCheckout releases and use it instead of `@master` branch in `uses`.\n\n## Options\n\n### Required options\n\n- `image`\n- `username`\n- `password`\n\n```yaml\nwith:\n  image: owner/image\n  username: ${{ secrets.DOCKER_USERNAME }}\n  password: ${{ secrets.DOCKER_PASSWORD }}\n```\n\n### `registry`\n\n- Default: —\n\nGitHub's Docker registry uses a different path format. See [Configuring Docker for use with GitHub Package Registry](https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#publishing-a-package)\n\n```yaml\nwith:\n  image: owner/repository/image\n  username: ${{ github.actor }}\n  password: ${{ secrets.GITHUB_TOKEN }}\n  registry: docker.pkg.github.com\n```\n\n### `dockerfile`\n\n- Default: \"Dockerfile\"\n\nThis might be useful when you hanve multiple Dockerfiles in one repo.\n\n```yaml\nwith:\n  image: owner/image\n  username: ${{ secrets.DOCKER_USERNAME }}\n  password: ${{ secrets.DOCKER_PASSWORD }}\n  dockerfile: project.Dockerfile\n```\n\n### `context`\n\n- Default: —\n\nUse `context` when you would like to change the Docker build context.\n\n```yaml\nwith:\n  image: owner/image\n  username: ${{ secrets.DOCKER_USERNAME }}\n  password: ${{ secrets.DOCKER_PASSWORD }}\n  context: directory/of/the/context\n```\n\n### `workdir`\n\n- Default: —\n\nUse `workdir` when you would like to change the directory for building.\n\n```yaml\nwith:\n  image: owner/image\n  username: ${{ secrets.DOCKER_USERNAME }}\n  password: ${{ secrets.DOCKER_PASSWORD }}\n  workdir: project/subdirectory\n```\n\n### `buildargs`\n\n- Default: —\n\nUse `buildargs` when you want to pass a list of environment variables as [build-args](https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg). Identifiers are separated by space.\nAll `buildargs` will be masked, so that they don't appear in the logs.\n\n```yaml\n- name: Publish to Registry\n  uses: sergeysova/docker-publish-action@master\n  env:\n    FOO: ${{ secrets.FOO_CONTENT }}\n    BAR: AnotherSecretValue\n  with:\n    image: myDocker/repository\n    username: ${{ secrets.DOCKER_USERNAME }}\n    password: ${{ secrets.DOCKER_PASSWORD }}\n    buildargs: FOO BAR\n```\n\n### `buildoptions`\n\n- Default: —\n\nUse `buildoptions` when you want to configure [options](https://docs.docker.com/engine/reference/commandline/build/#options) for building.\n\n```yaml\n- name: publish docker image\n  uses: sergeysova/docker-publish-action@master\n  with:\n    image: myDocker/repository\n    username: ${{ secrets.DOCKER_USERNAME }}\n    password: ${{ secrets.DOCKER_PASSWORD }}\n    buildoptions: \"--compress --force-rm\"\n```\n\n### `buildkit`\n\n- Default: false\n\nEnable [buildkit](https://docs.docker.com/develop/develop-images/build_enhancements/) to be used when building the image.\n\n```yaml\n- name: publish docker image\n  uses: sergeysova/docker-publish-action@master\n  with:\n    image: myDocker/repository\n    username: ${{ secrets.DOCKER_USERNAME }}\n    password: ${{ secrets.DOCKER_PASSWORD }}\n    buildkit: true\n```\n\n### `cache`\n\n- Available values: `true` | `false`\n- Default: `false`\n\nUse cache when you have big images, that you would only like to build partially (changed layers).\n\n\u003e CAUTION: Docker builds will cache non-repoducable commands, such as installing packages. If you use this option, your packages will never update. To avoid this, run this action on a schedule with caching _disabled_ to rebuild the cache periodically.\n\nExample:\n\n```yaml\nname: Publish to Registry\non:\n  push:\n    branches:\n      - master\n  schedule:\n    - cron: \"0 2 * * 0\" # Weekly on Sundays at 02:00\n\njobs:\n  update:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@master\n\n      - name: publish docker image\n        uses: sergeysova/docker-publish-action@master\n        with:\n          image: myDocker/repository\n          username: ${{ secrets.DOCKER_USERNAME }}\n          password: ${{ secrets.DOCKER_PASSWORD }}\n          cache: ${{ github.event_name != 'schedule' }}\n```\n\n### `snapshot`\n\n- Available values: `true` | `false`\n- Default: `false`\n\nBuild image also with tag `20200405-124909-5b9727` (date-time-hash)\n\n### `tag_extra`\n\n- Available values: any string\n- Default: —\n\nBuild an image with another tags. To set multiple use space.\n\nIf changes were on master, added tag `latest`\n\nExample:\n\n```yaml\nwith:\n  tag_extra: foo\n\n  # multiple\n  tag_extra: foo bar\n```\n\n### `tag_separator`\n\n- Available values: any string\n- Default: —\n\nParses git tag as two parts project name and version.\n\nExample:\n\n```yaml\nwith:\n  tag_separator: \"@\"\n```\n\n| Input                 | Parsed                                              |\n| --------------------- | --------------------------------------------------- |\n| `project-name@v1.2.3` | project name: `project-name`\u003cbr/\u003e version: `v1.2.3` |\n| `highway/car@demo`    | project name: `highway/car`\u003cbr/\u003e version: `demo`    |\n\n### `tag_semver`\n\n- Available values: `\"skip\"` | `\"fail\"`\n- Default: —\n\nParses git tag as semver `v1.2.3` or `1.2.3` or `1.2.3-something` and push docker tag `1.2.3`.\n\n| Value    | Description                              |\n| -------- | ---------------------------------------- |\n| Default  | Do nothing with tag                      |\n| `\"skip\"` | If tag is not a semver, do not push tag. |\n| `\"fail\"` | If tag is not a semver, fail the build.  |\n\nIf used with **`tag_separator`** parses version as semver:\n\n| Input                 | Version       |\n| --------------------- | ------------- |\n| `demo@v0.1.2`         | `1.2.3`       |\n| `my-name@1.2.3-alpha` | `1.2.3-alpha` |\n\nExample:\n\n```yaml\nwith:\n  tag_semver: skip\n```\n\n### `semver_higher`\n\n- Requires: `tag_semver`\n- Available values: `true` | `false`\n- Default: `false`\n\nAlso push tags with higher version updates.\n\n| Input                 | Tags                                                                             |\n| --------------------- | -------------------------------------------------------------------------------- |\n| `v1.2.3`              | `1.2.3` , `1.2` , `1`                                                            |\n| `v1.2.3-alpha`        | `1.2.3-alpha` , `1.2-alpha` , `1-alpha`                                          |\n| `v1.2.3-beta.1-int.2` | `1.2.3-beta.1-int.2` , `1.2.3-beta.1-int` , `1.2.3-beta` , `1.2-beta` , `1-beta` |\n| `v1.2.3-4.5.6`        | `1.2.3-4.5.6` , `1.2.3-4.5` , `1.2.3-4` , `1.2-4` , `1-4`                        |\n\nExample:\n\n```yaml\nwith:\n  semver_higher: true\n```\n\n## ToDo\n\n- [x] `cache` to build only changed layers for big docker images\n- [ ] `projectAppend` append project from tag with separator to image name\n- [ ] Pass password to `docker login` with `--password-stdin` when applicable\n- [ ] Check that dockerfile, context and workdir is present\n\n## Reading\n\n- [Actions versioning](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergeysova%2Fdocker-publish-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsergeysova%2Fdocker-publish-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergeysova%2Fdocker-publish-action/lists"}