Skip to content

Commit

Permalink
docs: initial github container registry integration guide (#7088)
Browse files Browse the repository at this point in the history
* docs: initial github container registry integration guide

Signed-off-by: Luke Marsden <me@lukemarsden.net>

* docs: fix link to main.go

Signed-off-by: Luke Marsden <me@lukemarsden.net>

* docs: hopefully convince linter this isn't a real go file

Signed-off-by: Luke Marsden <me@lukemarsden.net>

* Update docs/current_docs/integrations/snippets/ghcr-workflow.yml

Co-authored-by: vikram-dagger <112123850+vikram-dagger@users.noreply.github.com>
Signed-off-by: lukemarsden <me@lukemarsden.net>

* Integrates examplein to GitHub Actions integ page

Signed-off-by: Vikram Vaswani <vikram@dagger.io>

* rename

Signed-off-by: Luke Marsden <me@lukemarsden.net>

* bump tag

Signed-off-by: Luke Marsden <me@lukemarsden.net>

---------

Signed-off-by: Luke Marsden <me@lukemarsden.net>
Signed-off-by: lukemarsden <me@lukemarsden.net>
Signed-off-by: Vikram Vaswani <vikram@dagger.io>
Co-authored-by: vikram-dagger <112123850+vikram-dagger@users.noreply.github.com>
Co-authored-by: Vikram Vaswani <vikram@dagger.io>
  • Loading branch information
3 people committed Apr 26, 2024
1 parent 3285542 commit 379e812
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/current_docs/integrations/642920-github-actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ The following code sample demonstrates how to integrate Dagger with GitHub Actio
```yaml title=".github/workflows/dagger.yml" file=./snippets/actions.yml
```

The following code sample demonstrates how to use Dagger in a GitHub Action to publish a container image to GitHub Container Registry.

```yaml title=".github/workflows/dagger.yml" file=./snippets/actions-ghcr.yml
```


More information is available in the [Dagger for GitHub Action page](https://github.com/marketplace/actions/dagger-for-github).
35 changes: 35 additions & 0 deletions docs/current_docs/integrations/snippets/actions-ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: dagger
on:
push:
branches: [main]

jobs:
build-publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Call Dagger Function to build and publish to ghcr.io
uses: dagger/dagger-for-github@v5
with:
version: "latest"
verb: call
# modify to use different function(s) as needed
module: github.com/daggerverse/dagger-ghcr-demo@v0.1.5
args: build-and-push --registry=$DOCKER_REGISTRY --image-name=$DOCKER_IMAGE_NAME --username=$DOCKER_USERNAME --password=env:DOCKER_PASSWORD --build-context=github.com/daggerverse/dagger-ghcr-demo
# assumes the Dagger Cloud token is in
# a repository secret named DAGGER_CLOUD_TOKEN
# set via the GitHub UI/CLI
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
env:
DOCKER_REGISTRY: ghcr.io
DOCKER_IMAGE_NAME: ${{ github.repository }}
DOCKER_USERNAME: ${{ github.actor }}
# assumes the container registry password is in
# a repository secret named REGISTRY_PASSWORD
# set via the GitHub UI/CL
DOCKER_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
5 changes: 3 additions & 2 deletions docs/current_docs/integrations/snippets/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ jobs:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
-
name: Call Dagger Function
uses: dagger/dagger-for-github@v5
with:
version: "0.10.2"
version: "latest"
verb: call
# assumes a Go project
# modify to use different function(s) as needed
Expand Down

0 comments on commit 379e812

Please sign in to comment.