Skip to content

Commit

Permalink
chore: adds support for GHCR
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgilman committed Aug 30, 2024
1 parent d8fe15b commit 712f3be
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
3 changes: 3 additions & 0 deletions blueprint.cue
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ ci: {
org: "Catalyst"
satellite: "ci"
}
github: {
registry: "ghcr.io"
}
}
}
12 changes: 12 additions & 0 deletions blueprint/schema/_embed/schema.cue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ package schema
// Earthly contains the configuration for the Earthly Cloud provider.
// +optional
earthly?: #ProviderEarthly @go(Earthly)
github: #ProviderGithub @go(Github)
}

// ProviderAWS contains the configuration for the AWS provider.
Expand Down Expand Up @@ -82,6 +83,17 @@ package schema
satellite?: null | string @go(Satellite,*string)
}

// ProviderGithub contains the configuration for the Github provider.
#ProviderGithub: {
// Credentials contains the credentials to use for Github
// +optional
Credentials?: #Secret

// Registry contains the Github registry to use.
// +optional
Registry?: null | string @go(,*string)
}

// Secret contains the secret provider and a list of mappings
#Secret: {
// Path contains the path to the secret.
Expand Down
13 changes: 13 additions & 0 deletions blueprint/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ type Providers struct {
// Earthly contains the configuration for the Earthly Cloud provider.
// +optional
Earthly ProviderEarthly `json:"earthly"`

Github ProviderGithub `json:"github"`
}

// ProviderAWS contains the configuration for the AWS provider.
Expand Down Expand Up @@ -88,6 +90,17 @@ type ProviderEarthly struct {
Satellite *string `json:"satellite"`
}

// ProviderGithub contains the configuration for the Github provider.
type ProviderGithub struct {
// Credentials contains the credentials to use for Github
// +optional
Credentials Secret

// Registry contains the Github registry to use.
// +optional
Registry *string
}

// Secret contains the secret provider and a list of mappings
type Secret struct {
// Path contains the path to the secret.
Expand Down
12 changes: 12 additions & 0 deletions blueprint/schema/schema_go_gen.cue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ package schema
// Earthly contains the configuration for the Earthly Cloud provider.
// +optional
earthly?: #ProviderEarthly @go(Earthly)
github: #ProviderGithub @go(Github)
}

// ProviderAWS contains the configuration for the AWS provider.
Expand Down Expand Up @@ -82,6 +83,17 @@ package schema
satellite?: null | string @go(Satellite,*string)
}

// ProviderGithub contains the configuration for the Github provider.
#ProviderGithub: {
// Credentials contains the credentials to use for Github
// +optional
Credentials?: #Secret

// Registry contains the Github registry to use.
// +optional
Registry?: null | string @go(,*string)
}

// Secret contains the secret provider and a list of mappings
#Secret: {
// Path contains the path to the secret.
Expand Down
25 changes: 25 additions & 0 deletions forge/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ inputs:
forge_version:
description: The version of the forge CLI to install (use 'local' for testing)
default: latest
github_token:
description: Github token assigned to CI
required: false
default: ${{ github.token }}
runs:
using: composite
steps:
Expand Down Expand Up @@ -92,6 +96,27 @@ runs:
username: ${{ steps.docker.outputs.username }}
password: ${{ steps.docker.outputs.password }}

# GitHub Provider
- name: Get GitHub provider configuration
id: github
shell: bash
run: |
BP=$(forge blueprint dump .)
GITHUB=$(echo "$BP" | jq -r .ci.providers.github.registry)
if [[ "$GITHUB" != "null" ]]; then
LOGIN=1
fi
echo "login=$LOGIN" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: steps.github.outputs.login
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ inputs.github_token }}

# Earthly Provider
- name: Install Earthly
uses: earthly/actions-setup@v1
Expand Down

0 comments on commit 712f3be

Please sign in to comment.