Skip to content

change to myapp for easier renaming #38

change to myapp for easier renaming

change to myapp for easier renaming #38

name: Build and Release
on:
pull_request:
branches: main
push:
branches: main
tags:
- "*.*.*"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
buildAndRelease:
runs-on: ubuntu-latest
permissions:
# needed for creating a release
contents: write
# needed for pushing docker image
attestations: write
id-token: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Name and Version
run: |
NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}
VERSION=${GITHUB_REF_NAME#*/}
echo "NAME=${NAME}" >> $GITHUB_ENV
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo Using name=$NAME and version=$VERSION
- name: Set up Docker
uses: docker/setup-buildx-action@v2
- name: Set up Helm
uses: azure/setup-helm@v4.2.0
- name: Build Docker image
run: |
docker build -t ghcr.io/${{ github.repository_owner }}/$NAME:$VERSION .
- name: Build Helm package
run: helm package ./helm
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
name: Release ${{ github.ref_name }}
draft: false
prerelease: false
#body_path: CHANGELOG.md
files: |
*.tgz
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
if: startsWith(github.ref, 'refs/tags/')
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker image
if: startsWith(github.ref, 'refs/tags/')
run: |
docker push ghcr.io/${{ github.repository_owner }}/$NAME:$VERSION