deps(go): bump the common-golang group with 3 updates (#3223) #254
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: Release | |
permissions: | |
contents: read | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
inputs: | |
release_tag: | |
description: 'Image tag in the format x.x.x(-rcx)' | |
required: true | |
type: string | |
draft_release: | |
description: 'Publish as a draft' | |
required: true | |
default: true | |
type: boolean | |
env: | |
DRAFT_RELEASE: ${{ github.event_name == 'workflow_dispatch' && inputs.draft_release == true && 'true' || 'false' }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
run_if: | |
if: "${{ (github.event_name == 'push' && startsWith(github.event.head_commit.message, 'pre-release: Update version to')) || github.event_name == 'workflow_dispatch' }}" | |
runs-on: ubuntu-latest | |
outputs: | |
release_tag: ${{ steps.release_tag.outputs.release_tag }} | |
steps: | |
- run: echo "Triggered by ${{ github.event_name }}" | |
- run: 'echo "Draft release: ${{ env.DRAFT_RELEASE }}"' | |
- id: release_tag | |
env: | |
COMMIT_MESSAGE: ${{github.event.head_commit.message}} | |
run: | | |
if [[ ${{github.event_name}} == "push" ]] | |
then | |
[[ "${COMMIT_MESSAGE}" =~ ^pre-release:\ Update\ version\ to\ ([0-9]*\.[0-9]*\.[0-9]*(\-[0-9a-z]+)?)\ .*$ ]] && echo "release_tag=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT | |
else | |
echo "release_tag=${{inputs.release_tag}}" >> $GITHUB_OUTPUT | |
fi | |
create_tag: | |
needs: run_if | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
RELEASE_TAG: ${{ needs.run_if.outputs.release_tag }} | |
outputs: | |
tag_url: ${{ steps.output_tag.outputs.tag_url }} | |
environment: | |
name: release | |
url: ${{ steps.output_tag.outputs.tag_url }} | |
steps: | |
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
- id: create_tag | |
run: | | |
git config --global user.name 'Kasten Production' | |
git config --global user.email '[email protected]' | |
git tag -a "${RELEASE_TAG}" -m "Release version" | |
git push origin "${RELEASE_TAG}" | |
- id: output_tag | |
run: echo "tag_url=https://github.com/kanisterio/kanister/releases/tag/${RELEASE_TAG}" >> "$GITHUB_OUTPUT" | |
release_packages: | |
runs-on: ubuntu-latest | |
needs: [run_if, create_tag] | |
permissions: | |
packages: write | |
contents: write | |
env: | |
RELEASE_TAG: ${{ needs.run_if.outputs.release_tag }} | |
outputs: | |
release: ${{ steps.output_release.outputs.release_url }} | |
environment: | |
name: release | |
url: ${{ steps.output_release.outputs.release_url }} | |
steps: | |
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
with: | |
ref: ${{ env.RELEASE_TAG }} | |
fetch-depth: 0 | |
- name: build helm charts | |
run: | | |
export PACKAGE_FOLDER=helm_package | |
export HELM_RELEASE_REPO_URL=https://github.com/kanisterio/kanister/releases/download/${RELEASE_TAG} | |
export HELM_RELEASE_REPO_INDEX=https://charts.kanister.io/ | |
make package-helm VERSION=${RELEASE_TAG} | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
- name: gorelease | |
run: make gorelease | |
env: | |
GHCR_LOGIN_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GHCR_LOGIN_USER: ${{ github.actor }} | |
GORELEASE_PARAMS: ${{ env.DRAFT_RELEASE == 'true' && '--draft' || '' }} | |
- id: output_release | |
run: echo "release_url=https://github.com/kanisterio/kanister/releases/tag/${RELEASE_TAG}" >> "$GITHUB_OUTPUT" | |
build_docs: | |
needs: [run_if, release_packages] | |
permissions: | |
contents: read | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
uses: ./.github/workflows/publish_docs.yaml | |
with: | |
release_tag: ${{ needs.run_if.outputs.release_tag }} | |
publish_charts: | |
runs-on: ubuntu-latest | |
needs: [run_if, release_packages] | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
RELEASE_TAG: ${{ needs.run_if.outputs.release_tag }} | |
steps: | |
- name: clone helm pages | |
run: | | |
git clone https://infraq:${GH_TOKEN}@github.com/kanisterio/kanister-charts | |
- name: Download the helm index | |
working-directory: ./kanister-charts | |
run: | | |
curl https://github.com/kanisterio/kanister/releases/download/${RELEASE_TAG}/helm_index.yaml -f -L -o index.yaml | |
- name: Commit changes | |
working-directory: ./kanister-charts | |
run: | | |
git config --global user.name 'Kasten Production' | |
git config --global user.email '[email protected]' | |
git add -A | |
git commit -s -m "Update chart index to ${RELEASE_TAG}" | |
- name: Push changes | |
working-directory: ./kanister-charts | |
run: | | |
git push | |
## TODO: using https://github.com/slackapi/slack-github-action/blob/main/README.md#technique-3-slack-incoming-webhook | |
## we need to set up incoming webhook | |
## Alternatively we can also configure a bot token https://github.com/slackapi/slack-github-action/blob/main/README.md#technique-2-slack-app | |
# notify_slack: | |
# needs: [release_packages, build_docs] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Send slack notification | |
# id: slack | |
# uses: slackapi/[email protected] | |
# with: | |
# ## TODO: optionally include more information? | |
# payload: | | |
# { | |
# "text": "Kanister release published: ${RELEASE_URL}", | |
# } | |
# env: | |
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
# RELEASE_URL: ${{ needs.release_packages.outputs.release_url }} | |
release_example_docker_images: | |
needs: [run_if, release_packages] | |
permissions: | |
packages: write | |
contents: read | |
uses: ./.github/workflows/build_example_images.yaml | |
with: | |
image_tag: ${{ needs.run_if.outputs.release_tag }} | |
ref: ${{ needs.run_if.outputs.release_tag }} |