Create Release #2507
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 Release | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
stable-dependency-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Check if chart has any beta dependencies | |
uses: mikefarah/yq@master | |
with: | |
cmd: | | |
RESULT=$(yq '[.dependencies[].version] | any_c(contains("beta"))' chart/Chart.yaml agent-chart/Chart.yaml) | |
if [[ $RESULT =~ "true" ]]; then | |
echo "Charts contain beta dependencies" | |
exit 1 | |
fi | |
semantic-release: | |
runs-on: ubuntu-latest | |
needs: stable-dependency-check | |
outputs: | |
release-version: ${{ steps.semantic.outputs.release-version }} | |
new-release-published: ${{ steps.semantic.outputs.new-release-published }} | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Set branch variable for semantic release | |
run: | | |
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then | |
BRANCHES="['main']" | |
else | |
BRANCHES="[{name: 'main', channel: 'beta', prerelease: 'beta'}, {name: 'dummy-release'}]" | |
fi | |
echo "BRANCHES=$BRANCHES" >> $GITHUB_ENV | |
- uses: codfish/semantic-release-action@cbd853afe12037afb1306caca9d6b1ab6a58cf2a # v1.10.0 | |
id: semantic | |
with: | |
branches: ${{ env.BRANCHES }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
helm: | |
runs-on: ubuntu-latest | |
needs: semantic-release | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Download yq | |
run: | | |
wget -nv -nc -O yq https://github.com/mikefarah/yq/releases/download/v4.20.2/yq_linux_amd64 | |
chmod +x yq | |
- name: Set version | |
run: | | |
git fetch --prune --unshallow | |
echo "RELEASE_VERSION=$(git describe --abbrev=0 --tags | sed -e 's/^v//')" >> $GITHUB_ENV | |
- name: Update chart version | |
run: ./yq -i e '.version = "${{ env.RELEASE_VERSION }}"' chart/Chart.yaml | |
- name: Update app version | |
run: ./yq -i e '.appVersion = "${{ env.RELEASE_VERSION }}"' chart/Chart.yaml | |
- name: Update agent chart version | |
run: ./yq -i e '.version = "${{ env.RELEASE_VERSION }}"' agent-chart/Chart.yaml | |
- name: Update agent app version | |
run: ./yq -i e '.appVersion = "${{ env.RELEASE_VERSION }}"' agent-chart/Chart.yaml | |
- name: Update crd app version | |
run: ./yq -i e '.appVersion = "${{ env.RELEASE_VERSION }}"' crd-chart/Chart.yaml | |
- name: Update crd chart version | |
run: ./yq -i e '.version = "${{ env.RELEASE_VERSION }}"' crd-chart/Chart.yaml | |
- name: Set up Helm | |
uses: azure/setup-helm@18bc76811624f360dbd7f18c2d4ecb32c7b87bab # v1.1 | |
with: | |
version: v3.8.0 | |
- name: Package Helm chart | |
run: | | |
make chart agent-chart crd-chart | |
- name: Clone charts repo | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
repository: "${{ github.repository_owner }}/charts" | |
path: charts | |
token: "${{ secrets.FLANKBOT }}" | |
- name: Update chart repo | |
run: | | |
cd charts | |
cp ../mission-control-*.tgz ./ | |
helm repo index --merge index.yaml . | |
- name: Push changes to chart repo | |
uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a # v4.16.0 | |
with: | |
commit_message: "Release ${{ env.RELEASE_VERSION }} of ${{ github.repository }}" | |
branch: gh-pages | |
repository: ./charts |