Skip to content

Commit

Permalink
feat: enterprise release workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
rjha-splunk committed Jan 29, 2025
1 parent e09d95a commit 3a78390
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 13 deletions.
62 changes: 59 additions & 3 deletions .github/workflows/cd-ghcr.io.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,16 @@ name: cd-ghcr
on:
push:
branches-ignore:
- "**"
- "feature/*"
- "hotfix/*"
- "enterprise/*" # Ignore all enterprise branches except `enterprise/release`
- "develop"
branches:
- "main"
- "enterprise/release"
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+" # Enterprise releases

permissions:
packages: write
Expand All @@ -29,12 +36,13 @@ permissions:

jobs:
release:
name: Release
name: Release (Main)
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
container: [container3, container3lite , enterprise]
container: [container3, container3lite] # Exclude enterprise from main releases
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -70,3 +78,51 @@ jobs:
for line in $CONTAINER_SOURCE_TAGS; do echo working on "$line"; /tmp/regctl image copy ghcr.io/${{ github.repository }}/${{ matrix.container }}:$VERSION $line; done
env:
CONTAINER_SOURCE_TAGS: ${{ steps.docker_action_meta.outputs.tags }}

release-enterprise:
name: Release (Enterprise)
if: github.ref == 'refs/heads/enterprise/release' || startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
container: [enterprise]

steps:
- uses: actions/checkout@v4
with:
submodules: false

- name: Setup regctl
run: |
curl -L https://github.com/regclient/regclient/releases/download/v0.4.7/regctl-linux-amd64 >/tmp/regctl
chmod 755 /tmp/regctl
- name: Login to GitHub Packages Docker Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta (Enterprise)
id: docker_meta_enterprise
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/enterprise
tags: |
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- id: Pull
name: Pull Enterprise Container
run: |
VERSION=$(cat package/etc/ENTERPRISE_VERSION)
echo "Enterprise version from file: $VERSION"
for line in $CONTAINER_SOURCE_TAGS; do
echo "Copying $VERSION -> $line"
/tmp/regctl image copy ghcr.io/${{ github.repository }}/enterprise:$VERSION $line
done
env:
CONTAINER_SOURCE_TAGS: ${{ steps.docker_meta_enterprise.outputs.tags }}
4 changes: 1 addition & 3 deletions .github/workflows/ci-enterprise.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ name: ci-enterprise
on:
push:
branches:
- "main"
- "enterprise/*"
pull_request:
branches:
- "main"
- "enterprise/*"
- "enterprise/release"


permissions:
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/update-tags.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
# release:
# types:
# - published
# - edited
- "[0-9]+.[0-9]+" ### Enterprise release

permissions:
actions: read
Expand All @@ -20,5 +17,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Update Semver Tags
- name: Update Semver Tags Main
uses: tchupp/actions-update-semver-tags@v1

- name: Update Semver Tags (Enterprise)
uses: tchupp/actions-update-semver-tags@v1
with:
tag_prefix: "" #Remove unnecessary v
8 changes: 6 additions & 2 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
name: 'next-major',
prerelease: true
}
{
name: 'enterprise/release',
prerelease: false
}

],
plugins: [
[
Expand Down Expand Up @@ -51,8 +56,7 @@
}
],
["@semantic-release/exec", {
"prepareCmd": "echo ${nextRelease.version} >package/etc/VERSION"

"prepareCmd": "if [ \"${BRANCH_NAME}\" = \"enterprise/release\" ]; then echo \"${nextRelease.version}\" > package/etc/ENTERPRISE_VERSION; else echo \"${nextRelease.version}\" > package/etc/VERSION; fi"
}],
["@semantic-release/git", {
"assets": [
Expand Down
1 change: 1 addition & 0 deletions package/etc/ENTERPRISE_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0

0 comments on commit 3a78390

Please sign in to comment.