forked from valerius257/k8s-nodelocaldns-helm
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
116 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Pull Request - Release Charts | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- 'charts/node-local-dns/**' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | ||
- name: Install Helm | ||
uses: azure/setup-helm@v3 | ||
with: | ||
version: v3.12.1 | ||
|
||
- name: Add dependency chart repos | ||
run: | | ||
helm repo add stable https://charts.helm.sh/stable | ||
helm repo add incubator https://charts.helm.sh/incubator | ||
- name: Get version | ||
id: get_version | ||
run: | | ||
version=$(grep 'version: ' charts/node-local-dns/Chart.yaml | awk '{print $2}') | ||
branch=$GITHUB_HEAD_REF | ||
pr_version="${version}-${branch}" | ||
echo "Defining PR version $pr_version for branch $branch" | ||
echo "Updating charts/node-local-dns/Chart.yaml version to ${pr_version}" | ||
sed -i "s/^version:.*/version: ${pr_version}/" charts/node-local-dns/Chart.yaml | ||
echo "pr_version=$pr_version" >> $GITHUB_ENV | ||
- name: Check and remove existing PR release | ||
run: | | ||
echo "Checking release $pr_version existence in $GITHUB_REPOSITORY" | ||
release_id=$( gh api -H "Accept: application/vnd.github.v3+json" /repos/$GITHUB_REPOSITORY/releases/tags/node-local-dns-$pr_version | jq -r .id ) | ||
if [ "$release_id" != "null" ]; then | ||
echo "Release node-local-dns-$pr_version exists. Deleting..." | ||
gh api -X DELETE /repos/$GITHUB_REPOSITORY/releases/$release_id | ||
echo "Deleting tag node-local-dns-$pr_version..." | ||
gh api -X DELETE /repos/$GITHUB_REPOSITORY/git/refs/tags/node-local-dns-$pr_version | ||
else | ||
echo "Release $pr_version does not exist. Continuing..." | ||
fi | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Run chart-releaser | ||
uses: helm/chart-releaser-action@v1.6.0 | ||
env: | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Ignore env files | ||
.env | ||
.envrc | ||
|
||
# Ignore editors | ||
.DS_Store | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters