Skip to content

Commit 3d5b4ae

Browse files
chore(release): v1.1.0 ✨
Merge pull request #1163 from Green-Software-Foundation/release-v1.1.0
1 parent 98305e0 commit 3d5b4ae

File tree

95 files changed

+7510
-3431
lines changed

Some content is hidden

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

95 files changed

+7510
-3431
lines changed

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ignore all
2+
*
3+
4+
# exclude only necessary items
5+
!src/common
6+
!src/if-*
7+
!package*.json
8+
!tsconfig.json
9+
!tsconfig.build.json
10+
!bin/docker-entrypoint.sh

.github/workflows/nodejs-ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ jobs:
77
pull-requests: write # this allows to show carbon and energy data table in PRs
88
steps:
99
- name: Eco CI Energy Estimation - Initialize
10-
uses: green-coding-solutions/[email protected]
11-
10+
uses: green-coding-solutions/eco-ci-energy-estimation@v5
1211
with:
1312
task: start-measurement
13+
send-data: true
14+
co2-calculation-method: "constant"
15+
co2-grid-intensity-constant: 383
1416
continue-on-error: true
1517

1618
- name: Checkout code
1719
uses: actions/checkout@v4
1820

1921
- name: Eco CI Energy Estimation - Get Measurement
20-
uses: green-coding-solutions/eco-ci-energy-estimation@v4.0-rc3
22+
uses: green-coding-solutions/eco-ci-energy-estimation@v5
2123

2224
with:
2325
task: get-measurement
@@ -31,7 +33,7 @@ jobs:
3133
cache: 'npm'
3234

3335
- name: Eco CI Energy Estimation - Get Measurement
34-
uses: green-coding-solutions/eco-ci-energy-estimation@v4.0-rc3
36+
uses: green-coding-solutions/eco-ci-energy-estimation@v5
3537

3638
with:
3739
task: get-measurement
@@ -43,7 +45,7 @@ jobs:
4345
run: npm install
4446

4547
- name: Eco CI Energy Estimation - Get Measurement
46-
uses: green-coding-solutions/eco-ci-energy-estimation@v4.0-rc3
48+
uses: green-coding-solutions/eco-ci-energy-estimation@v5
4749

4850
with:
4951
task: get-measurement
@@ -55,7 +57,7 @@ jobs:
5557
run: npm run lint
5658

5759
- name: Eco CI Energy Estimation - Get Measurement
58-
uses: green-coding-solutions/eco-ci-energy-estimation@v4.0-rc3
60+
uses: green-coding-solutions/eco-ci-energy-estimation@v5
5961

6062
with:
6163
task: get-measurement
@@ -67,19 +69,17 @@ jobs:
6769
run: npm run test --silent
6870

6971
- name: Eco CI Energy Estimation - Get Measurement
70-
uses: green-coding-solutions/eco-ci-energy-estimation@v4.0-rc3
72+
uses: green-coding-solutions/eco-ci-energy-estimation@v5
7173

7274
with:
7375
task: get-measurement
7476
label: "npm run test"
7577
continue-on-error: true
7678

7779
- name: Eco CI Energy Estimation - End Measurement
78-
uses: green-coding-solutions/eco-ci-energy-estimation@v4.0-rc3
80+
uses: green-coding-solutions/eco-ci-energy-estimation@v5
7981

8082
with:
8183
task: display-results
82-
send-data: true
8384
pr-comment: true
8485
continue-on-error: true
85-
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Publish Helm Chart
2+
3+
on:
4+
workflow_dispatch:
5+
6+
concurrency:
7+
group: publish-helm-chart
8+
cancel-in-progress: true
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Check chart version
21+
id: check-chart
22+
run: |
23+
OWNER_TYPE=`gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /users/${{ github.repository_owner }} --jq .type`
24+
if [ "$OWNER_TYPE" == 'Organization' ]; then
25+
PREFIX=/orgs
26+
else
27+
PREFIX=/users
28+
fi
29+
ENDPOINT="$PREFIX/${{ github.repository_owner }}/packages/container/charts%2Fif/versions"
30+
31+
CHART_VERSION=`yq .version helm-chart/Chart.yaml`
32+
EXISTS=`gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" $ENDPOINT --jq "any(.[]; .metadata.container.tags[]? == \"$CHART_VERSION\")" || true`
33+
if [ "$EXISTS" == 'true' ]; then
34+
echo "::error::$CHART_VERSION already exists"
35+
exit 1
36+
fi
37+
38+
CHART_NAME=`yq .name helm-chart/Chart.yaml`
39+
echo "name=$CHART_NAME" >> $GITHUB_OUTPUT
40+
echo "version=$CHART_VERSION" >> $GITHUB_OUTPUT
41+
env:
42+
GH_TOKEN: ${{ github.token }}
43+
44+
- name: Packaging
45+
run: |
46+
APP_VERSION=`gh release list --repo ${{ github.repository }} --json name,isLatest --jq '.[] | select(.isLatest) | .name'`
47+
helm package --app-version $APP_VERSION helm-chart
48+
env:
49+
GH_TOKEN: ${{ github.token }}
50+
51+
- name: Log in to the Container registry
52+
uses: docker/login-action@v3
53+
with:
54+
registry: ghcr.io
55+
username: ${{ github.actor }}
56+
password: ${{ github.token }}
57+
58+
- name: Push the chart to GHCR
59+
run: |
60+
OWNER_LOWER=${GITHUB_REPOSITORY_OWNER,,}
61+
helm push ${{ steps.check-chart.outputs.name }}-${{ steps.check-chart.outputs.version }}.tgz "oci://ghcr.io/$OWNER_LOWER/charts"

.github/workflows/release-commit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Node.js
2020
uses: actions/setup-node@v4
2121
with:
22-
node-version: 18
22+
node-version: 20
2323
registry-url: https://registry.npmjs.org/
2424

2525
- name: Install dependencies
@@ -40,7 +40,7 @@ jobs:
4040
- name: Setup Node.js
4141
uses: actions/setup-node@v4
4242
with:
43-
node-version: 18
43+
node-version: 20
4444
registry-url: https://registry.npmjs.org/
4545

4646
- name: Install dependencies
@@ -61,7 +61,7 @@ jobs:
6161
- name: Setup Node.js
6262
uses: actions/setup-node@v4
6363
with:
64-
node-version: 18
64+
node-version: 20
6565
registry-url: https://registry.npmjs.org/
6666

6767
- name: Install dependencies
Lines changed: 89 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1-
name: Release publish NPM
1+
name: Release publish NPM / container image
22
on:
33
push:
44
branches:
55
- release
66

77
jobs:
8-
release-publish-npm:
8+
final-check-before-release:
99
runs-on: ubuntu-latest
10+
outputs:
11+
latest-release-name: ${{ steps.release-info.outputs.latest-release-name }}
12+
is-pre-release: ${{ steps.release-info.outputs.is-pre-release }}
13+
container-release-tag: ${{ steps.release-info.outputs.container-release-tag }}
1014
steps:
1115
- name: Checkout code
1216
uses: actions/checkout@v4
1317

1418
- name: Setup Node.js
1519
uses: actions/setup-node@v4
1620
with:
17-
node-version: 18
21+
node-version: 20
1822
registry-url: https://registry.npmjs.org/
1923

2024
- name: Install dependencies
@@ -26,18 +30,17 @@ jobs:
2630
- name: Run integration tests
2731
run: npm run if-check -- -d manifests/outputs
2832

29-
- name: Initialize git user email
30-
run: git config --global user.email "${{ env.RELEASE_USER_EMAIL }}"
31-
32-
- name: Initialize git user name
33-
run: git config --global user.name "Release publish workflow"
33+
- name: Archive checked source tree (to keep permissions)
34+
run: tar cfz /tmp/src.tar.gz .
3435

35-
- name: Initialize npm config
36-
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
37-
env:
38-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36+
- name: Upload checked source tree for the release
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: src
40+
path: /tmp/src.tar.gz
3941

4042
- name: Fetch latest release info
43+
id: release-info
4144
run: |
4245
RELEASE_JSON=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
4346
"https://api.github.com/repos/${{ github.repository }}/releases")
@@ -50,24 +53,85 @@ jobs:
5053
LATEST_RELEASE_NAME=$(echo "$RELEASE_JSON" | jq -r '.[0].name')
5154
IS_PRE_RELEASE=$(echo "$RELEASE_JSON" | jq -r '.[0].prerelease')
5255
53-
echo "LATEST_RELEASE_NAME=$LATEST_RELEASE_NAME" >> $GITHUB_ENV
54-
echo "IS_PRE_RELEASE=$IS_PRE_RELEASE" >> $GITHUB_ENV
56+
echo "latest-release-name=$LATEST_RELEASE_NAME" >> $GITHUB_OUTPUT
57+
echo "is-pre-release=$IS_PRE_RELEASE" >> $GITHUB_OUTPUT
58+
if [ "$IS_PRE_RELEASE" == 'true' ]; then
59+
echo "container-release-tag=pre" >> $GITHUB_OUTPUT
60+
else
61+
echo "container-release-tag=latest" >> $GITHUB_OUTPUT
62+
fi
5563
56-
- name: Fetch and checkout to release branch
57-
run: |
58-
git fetch --all
59-
git checkout ${{ vars.RELEASE_BRANCH_NAME }}
64+
release-publish-npm:
65+
needs: [ final-check-before-release ]
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: Download source tree for the release
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: src
72+
path: ${{ github.workspace }}
6073

61-
- name: Publish to npm (pre-release)
62-
if: env.IS_PRE_RELEASE == 'true'
63-
run: npm publish --tag beta
74+
- name: Extract source tree
75+
run: tar xfz src.tar.gz
76+
77+
- name: Initialize npm config
78+
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
6479
env:
65-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
80+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6781

6882
- name: Publish to npm
69-
if: env.IS_PRE_RELEASE == 'false'
70-
run: npm publish
83+
run: |
84+
CMD="npm publish"
85+
if [ "${{ needs.final-check-before-release.outputs.is-pre-release }}" == 'true' ]; then
86+
CMD="$CMD --tag beta"
87+
fi
88+
$CMD
7189
env:
7290
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7391
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
92+
93+
release-container-image:
94+
needs: [ final-check-before-release ]
95+
permissions:
96+
packages: write
97+
runs-on: ubuntu-latest
98+
env:
99+
REGISTRY: ghcr.io
100+
steps:
101+
- name: Download source tree for the release
102+
uses: actions/download-artifact@v4
103+
with:
104+
name: src
105+
path: ${{ github.workspace }}
106+
107+
- name: Extract source tree
108+
run: tar xfz src.tar.gz
109+
110+
- name: Set up Docker Buildx
111+
uses: docker/setup-buildx-action@v3
112+
113+
- name: Log in to the Container registry
114+
uses: docker/login-action@v3
115+
with:
116+
registry: ${{ env.REGISTRY }}
117+
username: ${{ github.actor }}
118+
password: ${{ github.token }}
119+
120+
- name: Extract metadata (tags, labels)
121+
id: meta
122+
uses: docker/metadata-action@v5
123+
with:
124+
tags: |
125+
type=raw,value=${{ needs.final-check-before-release.outputs.container-release-tag }}
126+
type=raw,value=${{ needs.final-check-before-release.outputs.latest-release-name }}
127+
type=sha
128+
images: ${{ env.REGISTRY }}/${{ github.repository }}
129+
130+
- name: Build and push container image
131+
uses: docker/build-push-action@v6
132+
with:
133+
platforms: linux/amd64,linux/arm64
134+
push: true
135+
tags: ${{ steps.meta.outputs.tags }}
136+
labels: ${{ steps.meta.outputs.labels }}
137+
provenance: false

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ coverage
1212
.env
1313
src/__tests__/integration/manifest
1414
examples/outputs
15+
with-plugins/*
16+
!with-plugins/Dockerfile

0 commit comments

Comments
 (0)