1- name : Build helm chart
1+ name : Build container and chart
2+
3+ env :
4+ IMAGE_PLATFORMS : linux/386,linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le
25
36on :
4- workflow_dispatch :
5- push :
6- branches :
7- - main
7+ pull_request :
8+ branches-ignore :
9+ - " docu/**"
810 paths :
911 - " docker-image/**"
1012 - " helm/**"
13+ - " .github/workflows/**"
1114
1215jobs :
1316 generate_infos :
@@ -30,18 +33,84 @@ jobs:
3033 id : tag
3134 shell : bash
3235 run : |
33- echo "Tag: $(git describe --abbrev=0)"
36+ echo "Tag: $(git describe --abbrev=0), Version: $ACI_VERSION "
3437 echo "::set-output name=tag::$(git describe --abbrev=0)"
3538 echo "::set-output name=version::$ACI_VERSION"
3639 echo "::set-output name=pr::$ACI_PR"
37-
40+
41+ build-image :
42+ runs-on : ubuntu-latest
43+ needs : generate_infos
44+ steps :
45+ - name : Check out the repo
46+ uses : actions/checkout@v2
47+
48+ - name : Login to GitHub Container Registry
49+ uses : docker/login-action@v1
50+ with :
51+ registry : ghcr.io
52+ username : ${{ github.repository_owner }}
53+ password : ${{ secrets.GITHUB_TOKEN }}
54+
55+ - name : Set up QEMU
56+ uses : docker/setup-qemu-action@v1
57+ with :
58+ platforms : ${{ env.IMAGE_PLATFORMS }}
59+ - name : Set up Docker Buildx
60+ id : buildx
61+ uses : docker/setup-buildx-action@v1
62+
63+ - name : Build and push image
64+ uses : docker/build-push-action@v2
65+ with :
66+ builder : ${{ steps.buildx.outputs.name }}
67+ context : ./docker-image/
68+ platforms : ${{ env.IMAGE_PLATFORMS }}
69+ push : false
70+ tags : |
71+ ghcr.io/${{ github.repository }}:latest
72+ ghcr.io/${{ github.repository }}:${{ needs.generate_infos.outputs.version }}
73+
3874 build-helm-chart :
3975 runs-on : ubuntu-latest
40- needs : generate_tag
76+ needs : generate_infos
4177 steps :
4278 - name : Check out the repo
4379 uses : actions/checkout@v2
4480
81+ - name : Helm Installation
82+ 83+
84+ - name : Helm Package
85+ run : helm package ./helm --version "${{ needs.generate_infos.outputs.version }}" --app-version "${{ needs.generate_infos.outputs.version }}" -d out/
86+
87+ - name : Cache build outputs
88+ uses : actions/cache@v2
89+ env :
90+ cache-name : cache-outputs-modules
91+ with :
92+ path : out/
93+ key : dns-bind-${{ github.event.pull_request.head.sha }}-${{ hashFiles('out/dns-bind*') }}
94+ restore-keys : |
95+ dns-bind-${{ github.event.pull_request.head.sha }}
96+
97+ publish_release :
98+ runs-on : ubuntu-latest
99+ needs : [generate_infos, build-image, build-helm-chart]
100+ steps :
101+ - name : Checkout code
102+ uses : actions/checkout@v2
103+ - name : Setup awesome-ci
104+ uses : fullstack-devops/awesome-ci-action@main
105+
106+ - name : get cached build outputs
107+ uses : actions/cache@v2
108+ env :
109+ cache-name : cache-outputs-modules
110+ with :
111+ path : out/
112+ key : dns-bind-${{ github.event.pull_request.head.sha }}
113+
45114 - name : Check out helm-charts
46115 uses : actions/checkout@v2
47116 with :
@@ -50,26 +119,23 @@ jobs:
50119 ref : gh-pages
51120 persist-credentials : true
52121 path : helm-charts
53-
54- - name : Helm Installation
55- 56- with :
57- version : v3.7.2
58122
59- - name : Helm Package
60- run : helm package ./helm --version "${{ needs.generate_tag.outputs.release_version }}" --app-version "${{ needs.generate_tag.outputs.release_version }}" -d out/
61-
62- - name : Helm
63- env :
123+ # - name: Publish Release
124+ # run: awesome-ci release publish -releaseid "$ACI_RELEASE_ID" -asstes "file=out/$ARTIFACT1"
125+ # env:
126+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127+ # ACI_RELEASE_ID: ${{ needs.generate_infos.outputs.releaseid }}
128+ # ARTIFACT1: dns-bind-${{ needs.generate_infos.outputs.version }}.tgz
129+
130+ - name : Helm index
131+ env : # ACI_ARTIFACT_1_URL
64132 GITHUB_TOKEN : ${{ secrets.HELM_REPO_TOKEN }}
65133 run : |
66134 git config user.name "$GITHUB_ACTOR"
67135 git config user.email "[email protected] " 68136
69- helm repo index out/ --url https://github.com/fullstack-devops/helm-charts/releases/download/excalidraw-1.0.1/excalidraw-1.0.1.tgz --merge helm-charts/index.yaml
70-
71- CHART_PACKAGE_NAME="my-chart-0.1.0+$(git rev-parse --short "$GITHUB_SHA").tgz"
72- cd helm-chart-repository
73- git add "$CHART_PACKAGE_NAME"
74- git commit -m "$CHART_PACKAGE_NAME"
75- git push origin main
137+ helm repo index out/ --url "$ACI_ARTIFACT_1_URL" --merge helm-charts/index.yaml
138+
139+ cd helm-charts
140+ git status
141+ cat index.yaml
0 commit comments