Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/_pullRequest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Pull Request

on:
pull_request:
paths:
- 'actions/**/Dockerfile'
- 'actions/**/main.go'
- 'actions/**/go.mod'
- 'actions/**/go.sum'
- 'actions/**/action.yml'

jobs:
FindActionDockerfiles:
name: Find Action Dockerfiles
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.find-dockerfiles.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Find Dockerfiles in actions
id: find-dockerfiles
run: |
dockerfiles=$(find actions -name "Dockerfile" -type f -exec dirname {} \; | jq -R -s -c 'split("\n")[:-1]')
echo "matrix={\"actionPath\":$dockerfiles}" >> $GITHUB_OUTPUT
echo "Found action paths with Dockerfiles: $dockerfiles"

ValidateDockerBuilds:
name: Validate Docker Build
runs-on: ubuntu-latest
needs: FindActionDockerfiles
if: needs.FindActionDockerfiles.outputs.matrix != '{"actionPath":[]}'
strategy:
matrix: ${{ fromJson(needs.FindActionDockerfiles.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build Docker Image (No Push)
run: |
cd "${{ matrix.actionPath }}"
action_name=$(basename "${{ matrix.actionPath }}" | tr '[:upper:]' '[:lower:]')
echo "Building Docker image for action: $action_name"
docker build -t test-$action_name:pr-${{ github.event.pull_request.number }} .
echo "✅ Docker build successful for $action_name"
11 changes: 10 additions & 1 deletion .github/workflows/_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ permissions:
contents: write

jobs:
BuildCreateReleaseImage:
name: Build createRelease Action Image
uses: ./.github/workflows/github_createAndReleaseActionDockerImage.yml
with:
actionPath: 'actions/github/createRelease'
imageName: 'gh-action-create-github-release'
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

CreateRelease:
name: Create Release
uses: ./.github/workflows/github_createRelease.yml
Expand All @@ -37,4 +46,4 @@ jobs:
git tag -d v$major_version
git push origin --delete v$major_version
git tag v$major_version ${{github.ref}}
git push origin v$major_version
git push origin v$major_version
47 changes: 47 additions & 0 deletions .github/workflows/github_createAndReleaseActionDockerImage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Create and Release Action Docker Image

on:
workflow_call:
inputs:
actionPath:
description: 'Path to the action directory containing Dockerfile'
required: true
type: string
imageName:
description: 'Name of the Docker image (without registry prefix)'
required: true
type: string
registryPrefix:
description: 'Container registry prefix'
required: false
type: string
default: 'ghcr.io/encoredigitalgroup'
secrets:
token:
description: 'GitHub token for authentication'
required: true

jobs:
BuildAndPushDockerImage:
name: Build and Push Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
run: echo ${{ secrets.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build and Push Docker Image
run: |
cd ${{ inputs.actionPath }}
docker build -t ${{ inputs.registryPrefix }}/${{ inputs.imageName }}:latest .
docker tag ${{ inputs.registryPrefix }}/${{ inputs.imageName }}:latest ${{ inputs.registryPrefix }}/${{ inputs.imageName }}:${{ github.ref_name }}
docker push ${{ inputs.registryPrefix }}/${{ inputs.imageName }}:latest
docker push ${{ inputs.registryPrefix }}/${{ inputs.imageName }}:${{ github.ref_name }}

- name: Output Image Details
run: |
echo "Docker image built and pushed successfully:"
echo "Image: ${{ inputs.registryPrefix }}/${{ inputs.imageName }}"
echo "Tags: latest, ${{ github.ref_name }}"
6 changes: 6 additions & 0 deletions .github/workflows/github_createRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ jobs:
name: CreateRelease
runs-on: ubuntu-latest
steps:
- name: Deprecation Warning
run: |
echo "::warning::This workflow (github_createRelease.yml) is deprecated. Please use the actions/github/createRelease action instead."
echo "::warning::Migration guide: Replace 'uses: ./.github/workflows/github_createRelease.yml' with 'uses: ./actions/github/createRelease'"
echo "::warning::The new action provides better performance, more features, and includes Dependabot filtering options."

- name: Create Release
id: createRelease
uses: ncipollo/release-action@v1
Expand Down
29 changes: 29 additions & 0 deletions actions/github/createRelease/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM golang:1.24-alpine AS builder

WORKDIR /app

# Copy go mod and sum files
COPY go.mod go.sum ./

# Download dependencies
RUN go mod download

# Copy source code
COPY main.go ./

# Build the binary
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .

# Final stage - minimal image
FROM alpine:latest

# Install ca-certificates for HTTPS requests
RUN apk --no-cache add ca-certificates

WORKDIR /root/

# Copy the binary from builder stage
COPY --from=builder /app/main .

# Run the binary
ENTRYPOINT ["./main"]
33 changes: 33 additions & 0 deletions actions/github/createRelease/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Create Release'
description: 'Creates a GitHub Release'
inputs:
token:
description: 'GitHub token'
required: true
preRelease:
description: 'Pre-release'
required: false
default: 'false'
generateReleaseNotes:
description: 'Generate release notes'
required: false
default: 'true'
isDraft:
description: 'Is draft'
required: false
default: 'false'
includeDependabot:
description: 'Include Dependabot PRs in release notes'
required: false
default: 'false'
runs:
using: 'docker'
image: 'docker://ghcr.io/encoredigitalgroup/gh-action-create-github-release:latest'
env:
GH_TOKEN: ${{ secrets.token }}
GH_REPOSITORY: ${{ github.repository }}
TAG_NAME: ${{ github.ref_name }}
PRE_RELEASE: ${{ inputs.preRelease }}
GENERATE_RELEASE_NOTES: ${{ inputs.generateReleaseNotes }}
IS_DRAFT: ${{ inputs.isDraft }}
INCLUDE_DEPENDABOT: ${{ inputs.includeDependabot }}
29 changes: 29 additions & 0 deletions actions/github/createRelease/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module github.com/EncoreDigitalGroup/ci-workflows/actions/github/formatPullRequestTitle

go 1.24.1

require (
github.com/EncoreDigitalGroup/golib v0.1.5
github.com/google/go-github/v70 v70.0.0
golang.org/x/oauth2 v0.28.0
)

require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
github.com/charmbracelet/lipgloss v1.1.0 // indirect
github.com/charmbracelet/log v0.4.1 // indirect
github.com/charmbracelet/x/ansi v0.8.0 // indirect
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
github.com/charmbracelet/x/term v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/sys v0.30.0 // indirect
)
54 changes: 54 additions & 0 deletions actions/github/createRelease/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
github.com/EncoreDigitalGroup/golib v0.1.5 h1:o6l2ag515bkGXL2Nu+FvPuNYtZTznSRJUQCvCSR/UPg=
github.com/EncoreDigitalGroup/golib v0.1.5/go.mod h1:QRvCXOZhxOJLJTPiOo5RSZdAIt0f8wV5mF8oasHJcIE=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs=
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk=
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
github.com/charmbracelet/log v0.4.1 h1:6AYnoHKADkghm/vt4neaNEXkxcXLSV2g1rdyFDOpTyk=
github.com/charmbracelet/log v0.4.1/go.mod h1:pXgyTsqsVu4N9hGdHmQ0xEA4RsXof402LX9ZgiITn2I=
github.com/charmbracelet/x/ansi v0.8.0 h1:9GTq3xq9caJW8ZrBTe0LIe2fvfLR/bYXKTx2llXn7xE=
github.com/charmbracelet/x/ansi v0.8.0/go.mod h1:wdYl/ONOLHLIVmQaxbIYEC/cRKOQyjTkowiI4blgS9Q=
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8=
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/go-github/v70 v70.0.0 h1:/tqCp5KPrcvqCc7vIvYyFYTiCGrYvaWoYMGHSQbo55o=
github.com/google/go-github/v70 v70.0.0/go.mod h1:xBUZgo8MI3lUL/hwxl3hlceJW1U8MVnXP3zUyI+rhQY=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
golang.org/x/oauth2 v0.28.0 h1:CrgCKl8PPAVtLnU3c+EDw6x11699EWlsDeWNWKdIOkc=
golang.org/x/oauth2 v0.28.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Loading