Skip to content

Commit 0c0d94e

Browse files
author
gurghet
committed
feat: add docker image build workflow
1 parent 4e485a6 commit 0c0d94e

1 file changed

Lines changed: 1 addition & 101 deletions

File tree

.github/workflows/release.yaml

Lines changed: 1 addition & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,19 @@ on:
66
- master
77

88
permissions:
9-
contents: write
109
packages: write
11-
pull-requests: write
1210

1311
env:
1412
REGISTRY: ghcr.io
1513
IMAGE_NAME: ${{ github.repository }}/operator
1614

1715
jobs:
18-
release:
19-
runs-on: ubuntu-latest
20-
outputs:
21-
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
22-
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
23-
permissions:
24-
contents: write
25-
packages: write
26-
steps:
27-
- name: Checkout
28-
uses: actions/checkout@v4
29-
with:
30-
fetch-depth: 0
31-
persist-credentials: false
32-
33-
- name: Setup Node.js
34-
uses: actions/setup-node@v4
35-
with:
36-
node-version: 'lts/*'
37-
38-
- name: Install dependencies
39-
run: npm install -g semantic-release @semantic-release/git @semantic-release/github
40-
41-
- name: Semantic Release
42-
id: semantic
43-
uses: cycjimmy/semantic-release-action@v4
44-
with:
45-
semantic_version: 19
46-
branches: |
47-
[
48-
'master'
49-
]
50-
extra_plugins: |
51-
@semantic-release/git
52-
@semantic-release/github
53-
env:
54-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55-
5616
build-and-push:
57-
needs: release
58-
if: needs.release.outputs.new_release_published == 'true'
5917
runs-on: ubuntu-latest
6018
permissions:
6119
contents: read
6220
packages: write
6321
steps:
64-
- name: Debug outputs
65-
run: |
66-
echo "new_release_published: ${{ needs.release.outputs.new_release_published }}"
67-
echo "new_release_version: ${{ needs.release.outputs.new_release_version }}"
68-
6922
- name: Checkout
7023
uses: actions/checkout@v4
7124

@@ -86,58 +39,5 @@ jobs:
8639
push: true
8740
tags: |
8841
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
89-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.release.outputs.new_release_version }}
9042
cache-from: type=gha
91-
cache-to: type=gha,mode=max
92-
93-
publish-helm:
94-
needs: release
95-
if: needs.release.outputs.new_release_published == 'true'
96-
runs-on: ubuntu-latest
97-
permissions:
98-
contents: write
99-
steps:
100-
- name: Debug outputs
101-
run: |
102-
echo "new_release_published: ${{ needs.release.outputs.new_release_published }}"
103-
echo "new_release_version: ${{ needs.release.outputs.new_release_version }}"
104-
105-
- name: Checkout
106-
uses: actions/checkout@v4
107-
108-
- name: Install Helm
109-
uses: azure/setup-helm@v3
110-
with:
111-
version: v3.12.1
112-
113-
- name: Configure Git
114-
run: |
115-
git config user.name "${{ github.actor }}"
116-
git config user.email "${{ github.actor }}@users.noreply.github.com"
117-
118-
- name: Update Helm chart version
119-
run: |
120-
VERSION=${{ needs.release.outputs.new_release_version }}
121-
sed -i "s/^version:.*$/version: $VERSION/" charts/github-deploy-key-operator/Chart.yaml
122-
sed -i "s/^appVersion:.*$/appVersion: \"$VERSION\"/" charts/github-deploy-key-operator/Chart.yaml
123-
124-
- name: Package Helm chart
125-
run: |
126-
mkdir -p .cr-release-packages
127-
helm package charts/github-deploy-key-operator --version ${{ needs.release.outputs.new_release_version }} -d .cr-release-packages
128-
129-
- name: Checkout gh-pages branch
130-
run: |
131-
git fetch origin gh-pages || true
132-
git checkout gh-pages || git checkout --orphan gh-pages
133-
git rm -rf . || true
134-
git clean -fxd || true
135-
136-
- name: Update Helm repository
137-
run: |
138-
mkdir -p charts
139-
mv .cr-release-packages/* charts/
140-
helm repo index charts/
141-
git add charts/
142-
git commit -m "chore: publish helm chart v${{ needs.release.outputs.new_release_version }}"
143-
git push origin gh-pages
43+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)