-
Notifications
You must be signed in to change notification settings - Fork 1
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
3 changed files
with
67 additions
and
39 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -8,21 +8,21 @@ env: | |
|
||
jobs: | ||
python-test: | ||
name: Build and test App | ||
name: Build and test Python application | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
python-version: "3.10" | ||
- name: Install poetry | ||
run: pip install poetry | ||
- name: Build app | ||
run: poetry build | ||
- name: Test app | ||
run: | | ||
poetry install | ||
poetry run coverage run -m pytest | ||
poetry run pytest --cov=yourss | ||
poetry run coverage report | ||
poetry run coverage xml | ||
|
@@ -32,21 +32,43 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
|
||
- uses: docker/metadata-action@v5 | ||
id: meta | ||
with: | ||
images: ghcr.io/essembeh/yourss | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
push: true | ||
push: true | ||
|
||
helm-release: | ||
name: Update Helm repository | ||
if: github.ref == 'refs/heads/main' | ||
needs: docker-build | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Install Helm | ||
uses: azure/setup-helm@v3 | ||
- name: Run chart-releaser | ||
uses: helm/[email protected] | ||
with: | ||
skip_existing: true | ||
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,38 @@ | ||
#!/usr/bin/env bash | ||
set -eu -o pipefail | ||
|
||
[ "$1" = "patch" ] || [ "$1" = "minor" ] || [ "$1" = "major" ] | ||
|
||
# create new version with poetry | ||
VERSION=$(poetry version "$1" -s) | ||
|
||
# update charts | ||
yq e '.version = strenv(VERSION)' -i charts/yourss/Chart.yaml | ||
yq e '.appVersion = strenv(VERSION)' -i charts/yourss/Chart.yaml | ||
|
||
# add updated files to staging | ||
git add pyproject.toml charts/yourss/Chart.yaml | ||
git --no-pager diff --staged | ||
|
||
echo "" | ||
echo "" | ||
echo "" | ||
|
||
# ask confirmation before commit | ||
read -p "💡 Commit changes and create tag? [y/n] " -n 1 -r | ||
if [[ $REPLY =~ ^[Yy]$ ]]; then | ||
git commit --message "🔖 New release: $VERSION" | ||
git tag "$VERSION" | ||
|
||
# ask confirmation before push to origin | ||
read -p "💡 Push to origin? [y/n] " -n 1 -r | ||
if [[ $REPLY =~ ^[Yy]$ ]]; then | ||
git push | ||
git push --tags | ||
fi | ||
else | ||
# revert changes | ||
echo "Reverting changes ..." | ||
git reset HEAD pyproject.toml charts/yourss/Chart.yaml | ||
git checkout pyproject.toml charts/yourss/Chart.yaml | ||
fi |