modified action to MARK_AS_LATEST #8
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: Chart Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- develop | |
- master | |
env: | |
CR_CONFIGFILE: "${{ github.workspace }}/cr.yaml" | |
CR_TOOL_PATH: "${{ github.workspace }}/.cr-tool" | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
TARGET_BRANCH: "${{ github.ref_name }}" | |
MARK_AS_LATEST: "true" | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
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 "[email protected]" | |
- name: Install Helm | |
uses: azure/setup-helm@v4 | |
- name: Prepare GPG key #this step is for using exported keys and make your github runner | |
run: | | |
gpg_dir=.cr-gpg | |
mkdir "$gpg_dir" | |
keyring="$gpg_dir/secring.gpg" #referring keyring to private key of gpg | |
base64 -d <<< "$GPG_KEYRING_BASE64" > "$keyring" #storing base64 GPG key into keyring | |
passphrase_file="$gpg_dir/passphrase" | |
echo "$GPG_PASSPHRASE" > "$passphrase_file" #storing passphrase data into a file | |
echo "CR_PASSPHRASE_FILE=$passphrase_file" >> "$GITHUB_ENV" #saving passphrase into github-environment | |
echo "CR_KEYRING=$keyring" >> "$GITHUB_ENV" #saving private key into github-environemnt | |
env: | |
GPG_KEYRING_BASE64: "${{ secrets.GPG_KEYRING_BASE64 }}" #Referring secrets of github above | |
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}" | |
- name: Rename Chart | |
if: github.ref_name != 'master' | |
run: | | |
flatBranchName=$(echo "${{ env.TARGET_BRANCH }}" | sed 's/\//\-/g') | |
sed -i "s/name: \(.*\)/name: \1-${flatBranchName}/" charts/plane-ce/Chart.yaml | |
sed -i "s/name: \(.*\)/name: \1-${flatBranchName}/" charts/plane-enterprise/Chart.yaml | |
echo "MARK_AS_LATEST=false" >> "$GITHUB_ENV" #saving private key into github-environemnt | |
- name: Release Charts | |
uses: helm/[email protected] | |
with: | |
charts_dir: charts | |
config: cr.yaml | |
packages_with_index: false | |
skip_existing: true | |
mark_as_latest: ${{ env.MARK_AS_LATEST == 'true' }} | |
env: | |
CR_TOKEN: ${{ env.CR_TOKEN }} | |
CR_KEY: "Plane" | |
CR_KEYRING: ${{ env.CR_KEYRING }} | |
CR_PASSPHRASE_FILE: ${{ env.CR_PASSPHRASE_FILE }} | |
CR_SIGN: true |