{"id":22002936,"url":"https://github.com/rssnyder/ghcr-artifact-store","last_synced_at":"2025-03-23T06:12:39.258Z","repository":{"id":46946834,"uuid":"408599528","full_name":"rssnyder/ghcr-artifact-store","owner":"rssnyder","description":"use GitHub Container Registry to store regular artifacts","archived":false,"fork":false,"pushed_at":"2021-09-20T22:32:41.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-28T12:39:45.092Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","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/rssnyder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-20T21:03:01.000Z","updated_at":"2023-05-30T05:50:40.000Z","dependencies_parsed_at":"2022-09-05T05:21:30.188Z","dependency_job_id":null,"html_url":"https://github.com/rssnyder/ghcr-artifact-store","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rssnyder%2Fghcr-artifact-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rssnyder%2Fghcr-artifact-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rssnyder%2Fghcr-artifact-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rssnyder%2Fghcr-artifact-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rssnyder","download_url":"https://codeload.github.com/rssnyder/ghcr-artifact-store/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245061390,"owners_count":20554563,"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":[],"created_at":"2024-11-29T23:42:06.905Z","updated_at":"2025-03-23T06:12:39.235Z","avatar_url":"https://github.com/rssnyder.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ghcr-artifact-store\n\nUse github container registry (or any container registry) to store artifacts for your github actions workflows\n\n[![release](https://img.shields.io/github/v/release/rssnyder/ghcr-artifact-store?sort=semver\u0026logo=github\u0026color=blue)](https://github.com/rssnyder/ghcr-artifact-store/releases/latest)\n[![.github/workflows/test.yml](https://github.com/rssnyder/ghcr-artifact-store/actions/workflows/test.yml/badge.svg)](https://github.com/rssnyder/ghcr-artifact-store/actions/workflows/test.yml)\n\n## setup\n\nYou will need access to publish to github packages from your actions workflow. You can use the default `GITHUB_TOKEN` or a PAT.\n\nThe environment for your workflow will also need to have docker installed, which is included with `ubuntu-latest`.\n\nYou should run the action from the directory with your artifact to be uploaded using `working-directory`.\n\n## usage\n\n```yaml\ninputs:\n  method:\n    description: 'GET or PUT. Defaults to GET.'\n    required: false\n    default: GET\n  artifact:\n    description: 'Artifact to GET or PUT'\n    required: true\n  tag:\n    description: 'Tag for image when pushed to ghcr. Defaults to artifacts.'\n    required: false\n    default: artifacts\n  image:\n    description: 'Image to store. Defaults to ghcr.io/\u003cowner\u003e/\u003crepo\u003e.'\n    required: false\n    default: ''\n  registry_user:\n    description: 'Username for pushing to ghcr. Defaults to the user who trigered the workflow.'\n    required: false\n    default: ''\n  token:\n    description: 'Token for pushing to ghcr.'\n    required: true\n```\n\n### put\n\n```yaml\n- uses: rssnyder/ghcr-artifact-store@0.1.0\n  with:\n    method: PUT\n    artifact: state.json\n    token: ${{ secrets.GITHUB_TOKEN }}\n```\n\n### get\n\n```yaml\n- uses: rssnyder/ghcr-artifact-store@0.1.0\n  with:\n    artifact: state.json\n    token: ${{ secrets.GITHUB_TOKEN }}\n```\n\n## example\n\nSee an example of storing terraform state using this method [here](https://github.com/rssnyder/isengard/blob/master/.github/workflows/terraform.yml#L28).\n\n## bootstraping\n\nTo bootstrap an inital image for your repository, grab a github PAT with `packages:write` and set `GITHUB_TOKEN` to it and do the following steps locally:\n\n```shell\n# Login\n\u003e echo $GITHUB_TOKEN | docker login ghcr.io -u \u003cowner\u003e --password-stdin\n\n# Use busybox as source\n\u003e docker pull busybox\n\u003e docker tag busybox ghcr.io/\u003cowner\u003e/\u003crepo\u003e:artifacts\n\n# Push to ghcr\n\u003e docker push ghcr.io/\u003cowner\u003e/\u003crepo\u003e:artifacts\n```\n\nWhy `busybox`? I wanted to use a popular image that people could \"trust\" that was also as minimal as possible.\n\n```shell\n\u003e docker pull busybox\n\u003e docker images busybox --format \"{{.Repository}}:{{.Tag}} -\u003e {{.Size}}\"\nbusybox:latest -\u003e 1.24MB\n```\n\n## security\n\nBy default packages are private when first created and you must change them to public. If you are using this on a repository that is already publishing a public image to ghcr then **do not store sensitive information in your artifacts**.\n\nIn addition, you should tag your references to this composite to a version you have audited.\n\n## use locally\n\n```shell\nGITHUB_TOKEN=\u003cpat\u003e GITHUB_ACTOR=\u003cusername\u003e GITHUB_REPOSITORY=\u003cowner\u003e/\u003crepo\u003e METHOD=\"PUT\" sh action.sh state.json\nGITHUB_TOKEN=\u003cpat\u003e GITHUB_ACTOR=\u003cusername\u003e GITHUB_REPOSITORY=\u003cowner\u003e/\u003crepo\u003e sh action.sh state.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frssnyder%2Fghcr-artifact-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frssnyder%2Fghcr-artifact-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frssnyder%2Fghcr-artifact-store/lists"}