Skip to content

Commit c844fcd

Browse files
ci: update cd/cd build processes for docker (#22)
* ci: update cd/cd build processes for docker * chore(backend): update go namespaces
1 parent 2111ee1 commit c844fcd

File tree

127 files changed

+563
-374
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+563
-374
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Docker rootless publish
2+
3+
on:
4+
schedule:
5+
- cron: '00 6 * * *'
6+
push:
7+
branches: [ "main" ]
8+
# Publish semver tags as releases.
9+
tags: [ 'v*.*.*' ]
10+
pull_request:
11+
branches: [ "main" ]
12+
13+
env:
14+
# Use docker.io for Docker Hub if empty
15+
REGISTRY: ghcr.io
16+
# github.repository as <account>/<repo>
17+
IMAGE_NAME: ${{ github.repository }}
18+
19+
20+
jobs:
21+
build:
22+
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
# This is used to complete the identity challenge
28+
# with sigstore/fulcio when running outside of PRs.
29+
id-token: write
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
35+
# Install the cosign tool except on PR
36+
# https://github.com/sigstore/cosign-installer
37+
- name: Install cosign
38+
if: github.event_name != 'pull_request'
39+
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
40+
with:
41+
cosign-release: 'v2.2.4'
42+
43+
# Set up BuildKit Docker container builder to be able to build
44+
# multi-platform images and export cache
45+
# https://github.com/docker/setup-buildx-action
46+
- name: Set up Docker Buildx
47+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
48+
49+
# Login against a Docker registry except on PR
50+
# https://github.com/docker/login-action
51+
- name: Log into registry ${{ env.REGISTRY }}
52+
if: github.event_name != 'pull_request'
53+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
54+
with:
55+
registry: ${{ env.REGISTRY }}
56+
username: ${{ github.actor }}
57+
password: ${{ secrets.GITHUB_TOKEN }}
58+
59+
# Extract metadata (tags, labels) for Docker
60+
# https://github.com/docker/metadata-action
61+
- name: Extract Docker metadata
62+
id: meta
63+
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
64+
with:
65+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
66+
67+
# Build and push Docker image with Buildx (don't push on PR)
68+
# https://github.com/docker/build-push-action
69+
- name: Build and push Docker image
70+
id: build-and-push
71+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
72+
with:
73+
file: {context}/Dockerfile.rootless
74+
context: .
75+
push: ${{ github.event_name != 'pull_request' }}
76+
tags: ${{ steps.meta.outputs.tags }}
77+
labels: ${{ steps.meta.outputs.labels }}
78+
platforms: linux/amd64,linux/arm64,linux/arm/v7
79+
cache-from: type=gha
80+
cache-to: type=gha,mode=max
81+
82+
# Sign the resulting Docker image digest except on PRs.
83+
# This will only write to the public Rekor transparency log when the Docker
84+
# repository is public to avoid leaking data. If you would like to publish
85+
# transparency data even for private images, pass --force to cosign below.
86+
# https://github.com/sigstore/cosign
87+
- name: Sign the published Docker image
88+
if: ${{ github.event_name != 'pull_request' }}
89+
env:
90+
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
91+
TAGS: ${{ steps.meta.outputs.tags }}
92+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
93+
# This step uses the identity token to provision an ephemeral certificate
94+
# against the sigstore community Fulcio instance.
95+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

.github/workflows/docker-publish.yaml

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Docker publish
2+
3+
on:
4+
schedule:
5+
- cron: '00 6 * * *'
6+
push:
7+
branches: [ "main" ]
8+
# Publish semver tags as releases.
9+
tags: [ 'v*.*.*' ]
10+
pull_request:
11+
branches: [ "main" ]
12+
13+
env:
14+
# Use docker.io for Docker Hub if empty
15+
REGISTRY: ghcr.io
16+
# github.repository as <account>/<repo>
17+
IMAGE_NAME: ${{ github.repository }}
18+
19+
20+
jobs:
21+
build:
22+
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
# This is used to complete the identity challenge
28+
# with sigstore/fulcio when running outside of PRs.
29+
id-token: write
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
35+
# Install the cosign tool except on PR
36+
# https://github.com/sigstore/cosign-installer
37+
- name: Install cosign
38+
if: github.event_name != 'pull_request'
39+
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
40+
with:
41+
cosign-release: 'v2.2.4'
42+
43+
# Set up BuildKit Docker container builder to be able to build
44+
# multi-platform images and export cache
45+
# https://github.com/docker/setup-buildx-action
46+
- name: Set up Docker Buildx
47+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
48+
49+
# Login against a Docker registry except on PR
50+
# https://github.com/docker/login-action
51+
- name: Log into registry ${{ env.REGISTRY }}
52+
if: github.event_name != 'pull_request'
53+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
54+
with:
55+
registry: ${{ env.REGISTRY }}
56+
username: ${{ github.actor }}
57+
password: ${{ secrets.GITHUB_TOKEN }}
58+
59+
# Extract metadata (tags, labels) for Docker
60+
# https://github.com/docker/metadata-action
61+
- name: Extract Docker metadata
62+
id: meta
63+
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
64+
with:
65+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
66+
67+
# Build and push Docker image with Buildx (don't push on PR)
68+
# https://github.com/docker/build-push-action
69+
- name: Build and push Docker image
70+
id: build-and-push
71+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
72+
with:
73+
context: .
74+
push: ${{ github.event_name != 'pull_request' }}
75+
tags: ${{ steps.meta.outputs.tags }}
76+
labels: ${{ steps.meta.outputs.labels }}
77+
platforms: linux/amd64,linux/arm64,linux/arm/v7
78+
cache-from: type=gha
79+
cache-to: type=gha,mode=max
80+
81+
# Sign the resulting Docker image digest except on PRs.
82+
# This will only write to the public Rekor transparency log when the Docker
83+
# repository is public to avoid leaking data. If you would like to publish
84+
# transparency data even for private images, pass --force to cosign below.
85+
# https://github.com/sigstore/cosign
86+
- name: Sign the published Docker image
87+
if: ${{ github.event_name != 'pull_request' }}
88+
env:
89+
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
90+
TAGS: ${{ steps.meta.outputs.tags }}
91+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
92+
# This step uses the identity token to provision an ephemeral certificate
93+
# against the sigstore community Fulcio instance.
94+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

.scaffold/model/templates/model.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package schema
33
import (
44
"entgo.io/ent"
55

6-
"github.com/hay-kot/homebox/backend/internal/data/ent/schema/mixins"
6+
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/schema/mixins"
77
)
88

99
type {{ .Scaffold.model }} struct {

backend/internal/core/services/all.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
package services
33

44
import (
5-
"github.com/hay-kot/homebox/backend/internal/data/repo"
65
"github.com/sysadminsmedia/homebox/backend/internal/core/currencies"
6+
"github.com/sysadminsmedia/homebox/backend/internal/data/repo"
77
)
88

99
type AllServices struct {

backend/internal/core/services/reporting/bill_of_materials.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package reporting
22

33
import (
44
"github.com/gocarina/gocsv"
5-
"github.com/hay-kot/homebox/backend/internal/data/repo"
6-
"github.com/hay-kot/homebox/backend/internal/data/types"
5+
"github.com/sysadminsmedia/homebox/backend/internal/data/repo"
6+
"github.com/sysadminsmedia/homebox/backend/internal/data/types"
77
)
88

99
// =================================================================================================

backend/internal/core/services/reporting/io_row.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package reporting
33
import (
44
"strings"
55

6-
"github.com/hay-kot/homebox/backend/internal/data/types"
76
"github.com/sysadminsmedia/homebox/backend/internal/data/repo"
7+
"github.com/sysadminsmedia/homebox/backend/internal/data/types"
88
)
99

1010
type ExportItemFields struct {

backend/internal/core/services/reporting/io_sheet.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"strings"
1111

1212
"github.com/google/uuid"
13-
"github.com/hay-kot/homebox/backend/internal/data/repo"
14-
"github.com/hay-kot/homebox/backend/internal/data/types"
1513
"github.com/rs/zerolog/log"
14+
"github.com/sysadminsmedia/homebox/backend/internal/data/repo"
15+
"github.com/sysadminsmedia/homebox/backend/internal/data/types"
1616
)
1717

1818
// IOSheet is the representation of a CSV/TSV sheet that is used for importing/exporting

backend/internal/core/services/service_items_attachments.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import (
66
"os"
77

88
"github.com/google/uuid"
9-
"github.com/hay-kot/homebox/backend/internal/data/ent/attachment"
10-
"github.com/hay-kot/homebox/backend/internal/data/repo"
119
"github.com/rs/zerolog/log"
1210
"github.com/sysadminsmedia/homebox/backend/internal/data/ent"
11+
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/attachment"
12+
"github.com/sysadminsmedia/homebox/backend/internal/data/repo"
1313
)
1414

1515
func (svc *ItemService) AttachmentPath(ctx context.Context, attachmentID uuid.UUID) (*ent.Document, error) {

backend/internal/data/ent/attachment.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/internal/data/ent/attachment/where.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/internal/data/ent/attachment_create.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/internal/data/ent/attachment_delete.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/internal/data/ent/attachment_query.go

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/internal/data/ent/attachment_update.go

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/internal/data/ent/authroles.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/internal/data/ent/authroles/where.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/internal/data/ent/authroles_create.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/internal/data/ent/authroles_delete.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/internal/data/ent/authroles_query.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/internal/data/ent/authroles_update.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)