Skip to content

Commit 712f3be

Browse files
committed
chore: adds support for GHCR
1 parent d8fe15b commit 712f3be

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

blueprint.cue

+3
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,8 @@ ci: {
2323
org: "Catalyst"
2424
satellite: "ci"
2525
}
26+
github: {
27+
registry: "ghcr.io"
28+
}
2629
}
2730
}

blueprint/schema/_embed/schema.cue

+12
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ package schema
4646
// Earthly contains the configuration for the Earthly Cloud provider.
4747
// +optional
4848
earthly?: #ProviderEarthly @go(Earthly)
49+
github: #ProviderGithub @go(Github)
4950
}
5051

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

86+
// ProviderGithub contains the configuration for the Github provider.
87+
#ProviderGithub: {
88+
// Credentials contains the credentials to use for Github
89+
// +optional
90+
Credentials?: #Secret
91+
92+
// Registry contains the Github registry to use.
93+
// +optional
94+
Registry?: null | string @go(,*string)
95+
}
96+
8597
// Secret contains the secret provider and a list of mappings
8698
#Secret: {
8799
// Path contains the path to the secret.

blueprint/schema/schema.go

+13
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ type Providers struct {
5252
// Earthly contains the configuration for the Earthly Cloud provider.
5353
// +optional
5454
Earthly ProviderEarthly `json:"earthly"`
55+
56+
Github ProviderGithub `json:"github"`
5557
}
5658

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

93+
// ProviderGithub contains the configuration for the Github provider.
94+
type ProviderGithub struct {
95+
// Credentials contains the credentials to use for Github
96+
// +optional
97+
Credentials Secret
98+
99+
// Registry contains the Github registry to use.
100+
// +optional
101+
Registry *string
102+
}
103+
91104
// Secret contains the secret provider and a list of mappings
92105
type Secret struct {
93106
// Path contains the path to the secret.

blueprint/schema/schema_go_gen.cue

+12
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ package schema
4646
// Earthly contains the configuration for the Earthly Cloud provider.
4747
// +optional
4848
earthly?: #ProviderEarthly @go(Earthly)
49+
github: #ProviderGithub @go(Github)
4950
}
5051

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

86+
// ProviderGithub contains the configuration for the Github provider.
87+
#ProviderGithub: {
88+
// Credentials contains the credentials to use for Github
89+
// +optional
90+
Credentials?: #Secret
91+
92+
// Registry contains the Github registry to use.
93+
// +optional
94+
Registry?: null | string @go(,*string)
95+
}
96+
8597
// Secret contains the secret provider and a list of mappings
8698
#Secret: {
8799
// Path contains the path to the secret.

forge/actions/setup/action.yml

+25
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ inputs:
77
forge_version:
88
description: The version of the forge CLI to install (use 'local' for testing)
99
default: latest
10+
github_token:
11+
description: Github token assigned to CI
12+
required: false
13+
default: ${{ github.token }}
1014
runs:
1115
using: composite
1216
steps:
@@ -92,6 +96,27 @@ runs:
9296
username: ${{ steps.docker.outputs.username }}
9397
password: ${{ steps.docker.outputs.password }}
9498

99+
# GitHub Provider
100+
- name: Get GitHub provider configuration
101+
id: github
102+
shell: bash
103+
run: |
104+
BP=$(forge blueprint dump .)
105+
106+
GITHUB=$(echo "$BP" | jq -r .ci.providers.github.registry)
107+
if [[ "$GITHUB" != "null" ]]; then
108+
LOGIN=1
109+
fi
110+
111+
echo "login=$LOGIN" >> $GITHUB_OUTPUT
112+
- name: Login to GitHub Container Registry
113+
uses: docker/login-action@v3
114+
if: steps.github.outputs.login
115+
with:
116+
registry: ghcr.io
117+
username: ${{ github.actor }}
118+
password: ${{ inputs.github_token }}
119+
95120
# Earthly Provider
96121
- name: Install Earthly
97122
uses: earthly/actions-setup@v1

0 commit comments

Comments
 (0)