semantic release #19
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
name: create helm chart on release | |
on: | |
workflow_dispatch: | |
workflow_run: | |
workflows: ["Pull Request Closed"] # This is the workflow that will trigger this workflow as there is dependency between them | |
types: | |
- completed | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
pre-release: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Conventional Changelog Update | |
uses: TriPSs/conventional-changelog-action@v3 | |
id: changelog | |
continue-on-error: true | |
with: | |
github-token: ${{ github.token }} | |
output-file: 'CHANGELOG.md' | |
skip-version-file: 'true' | |
skip-commit: 'true' | |
skip-on-empty: 'false' | |
git-push: 'true' | |
- name: Extract Tag | |
id: tag | |
shell: bash | |
run: | | |
echo tag=${{ steps.changelog.outputs.tag }} | sed 's/v//' >> $GITHUB_OUTPUT | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
if: ${{ steps.tag.outputs.tag != '' }} | |
continue-on-error: true | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
token: ${{ github.token }} | |
tag_name: ${{ steps.changelog.outputs.tag }} | |
name: ${{ steps.changelog.outputs.tag }} | |
body: ${{ steps.changelog.outputs.clean_changelog }} | |
- name: Tag Docker Image for app container | |
uses: shrink/actions-docker-registry-tag@v3 | |
if: ${{ steps.tag.outputs.tag != '' }} | |
with: | |
registry: ghcr.io | |
repository: ${{ github.repository }}/nr-oracle-service | |
target: test | |
tags: ${{ steps.tag.outputs.tag }} | |
- name: Tag Docker Image for init container | |
uses: shrink/actions-docker-registry-tag@v3 | |
if: ${{ steps.tag.outputs.tag != '' }} | |
with: | |
registry: ghcr.io | |
repository: ${{ github.repository }}/nr-oracle-service-init | |
target: test | |
tags: ${{ steps.tag.outputs.tag }} | |
- name: Update Chart.yaml | |
if: ${{ steps.tag.outputs.tag != '' }} | |
run: | | |
git checkout -b update-chart-${{ steps.tag.outputs.tag }} | |
cd charts/nr-oracle-service | |
sed -i "s/^appVersion:.*/appVersion: ${{ steps.tag.outputs.tag }}/g" Chart.yaml | |
git add Chart.yaml | |
git commit -m "Update appVersion to ${{ steps.tag.outputs.tag }}" | |
git push origin update-chart-${{ steps.tag.outputs.tag }} | |
gh pr create --title "Update appVersion to ${{ steps.tag.outputs.tag }}" --body "Update appVersion to ${{ steps.tag.outputs.tag }}" --base main --head update-chart-${{ steps.tag.outputs.tag }} | |
gh pr merge --auto --merge --delete-branch update-chart-${{ steps.tag.outputs.tag }} | |
release: | |
runs-on: ubuntu-22.04 | |
needs: pre-release | |
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: Run chart-releaser | |
uses: helm/[email protected] | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |