-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created poetry version, tags and image versions for dashboard
- Loading branch information
Showing
7 changed files
with
1,547 additions
and
20 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,35 @@ | ||
name: Bump Poetry Version | ||
description: Bumps the poetry version based on the release type and creates a new git tag. | ||
inputs: | ||
releaseType: | ||
description: 'The type of release' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Bump poetry version | ||
shell: bash | ||
run: | | ||
# Create Latest Image Version | ||
poetry version "${{ inputs.releaseType }}" | ||
latest_image_version=$(poetry version --short) | ||
echo "LATEST_IMAGE_VERSION=$latest_image_version" >> $GITHUB_ENV | ||
# Create git Tag version for dashboard | ||
tag_version="dashboard-${latest_image_version}" | ||
echo "TAG_VERSION=$tag_version" >> $GITHUB_ENV | ||
# Add commit messsage for message bump | ||
git add . | ||
git commit -m "Bump poetry version to $latest_image_version" | ||
# Check if the new version tag already exists | ||
if git rev-parse "$tag_version" >/dev/null 2>&1; then | ||
echo "Tag $tag_version already exists." | ||
else | ||
# Commit and tag the new version | ||
echo "Tag $tag_version does not exist." | ||
git tag -a $tag_version -m "$tag_version" | ||
git show "$tag_version" | ||
fi |
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,23 @@ | ||
name: checkout-and-setup-python | ||
description: 'Checkout the repository and setup Python' | ||
inputs: | ||
python-version: | ||
description: 'Python version to use' | ||
required: false | ||
default: '3.11' | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- uses: actions/setup-python@v4 | ||
name: Setup Python | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
cache: 'pip' # caching pip dependencies | ||
|
||
- name: Git check | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "mantis" | ||
git --version | ||
git config --list | ||
shell: bash |
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,54 @@ | ||
name: Dashboard PR Release | ||
on: | ||
pull_request: | ||
branches: | ||
- dashboard | ||
types: | ||
- closed | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ncoder2/mantis-dashboard-upstream | ||
jobs: | ||
build-and-push-image: | ||
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
actions: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python and Git | ||
uses: ./.github/actions/setup-python-and-git | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install Poetry | ||
run: pip install poetry==1.4.2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
labels: ${{ steps.meta.outputs.labels }} |
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 |
---|---|---|
@@ -1,41 +1,74 @@ | ||
name: Mantis Dashboard Release | ||
name: Dashboard Latest Release | ||
on: | ||
push: | ||
branches: | ||
- dashboard | ||
workflow_dispatch: | ||
inputs: | ||
releaseType: | ||
description: 'What kind of release is this?' | ||
required: true | ||
type: choice | ||
options: | ||
- 'major' | ||
- 'minor' | ||
- 'patch' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: phonepe/mantis-dashboard | ||
|
||
jobs: | ||
build-and-push-image: | ||
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dashboard' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
contents: write | ||
packages: write | ||
|
||
actions: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
with: | ||
fetch-depth: 0 # added to fetch tags from git | ||
|
||
- name: Setup Python and Git | ||
uses: ./.github/actions/setup-python-and-git | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install Poetry | ||
run: pip install poetry==1.4.2 | ||
|
||
- name: Bump poetry version and add git tag | ||
uses: ./.github/actions/bump-version-and-git-tag | ||
with: | ||
releaseType: ${{ inputs.releaseType }} | ||
|
||
- name: Push tag changes | ||
run: | | ||
git push -u origin main | ||
git push origin ${{ env.TAG_VERSION }} | ||
git log -1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
tags: | | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.LATEST_IMAGE_VERSION }} | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
labels: ${{ steps.meta.outputs.labels }} |
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
Oops, something went wrong.