chore: bump duty to v1.0.765 (#2357) #1131
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 | |
- master | |
workflow_dispatch: | |
inputs: | |
version: | |
description: New version to create | |
required: false | |
default: "" | |
channel: | |
description: "Release channel" | |
required: true | |
default: "rc" | |
type: choice | |
options: | |
- stable | |
- rc | |
jobs: | |
semantic-release: | |
runs-on: ubuntu-latest | |
outputs: | |
release-version: ${{ env.VERSION || steps.semantic.outputs.new_release_version }} | |
new-release-published: ${{ steps.semantic.outputs.new-release-published }} | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Set branch variable for semantic release | |
run: | | |
if [[ "${{ inputs.version }}" != "" ]]; then | |
echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV | |
echo "TAG=v${{ inputs.version }}" >> $GITHUB_ENV | |
else | |
echo "VERSION=" >> $GITHUB_ENV | |
fi | |
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then | |
if [[ "${{ inputs.channel }}" == "stable" ]]; then | |
BRANCHES="['master']" | |
elif [[ "${{ inputs.channel }}" == "rc" ]]; then | |
BRANCHES="[{name: 'master', channel: 'rc', prerelease: 'rc'}, {name: 'dummy-release'}]" | |
fi | |
else | |
BRANCHES="[{name: 'master', channel: 'beta', prerelease: 'beta'}, {name: 'dummy-release'}]" | |
fi | |
echo "BRANCHES=$BRANCHES" >> $GITHUB_ENV | |
cat $GITHUB_ENV | |
- uses: cycjimmy/semantic-release-action@61680d0e9b02ff86f5648ade99e01be17f0260a4 # v4.0.0 | |
if: ${{ ! env.TAG }} | |
id: semantic | |
with: | |
branches: ${{ env.BRANCHES }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create tag | |
if: ${{ env.TAG }} | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/${{ env.TAG }}', | |
sha: context.sha | |
}) | |
binary: | |
runs-on: ubuntu-latest | |
needs: semantic-release | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Install Go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: v1.22.x | |
- uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
.bin | |
key: cache-${{ hashFiles('**/go.sum') }}-${{ hashFiles('.bin/*') }} | |
restore-keys: | | |
cache- | |
- run: make release | |
env: | |
VERSION: v${{ needs.semantic-release.outputs.release-version }} | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./.release/* | |
tag: v${{ needs.semantic-release.outputs.release-version }} | |
overwrite: true | |
file_glob: true | |
docker: | |
needs: semantic-release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Clear up disk space | |
run: | | |
rm -rf /usr/share/dotnet | |
rm -rf /opt/ghc | |
rm -rf /usr/local/share/boost | |
rm -rf $AGENT_TOOLSDIRECTORY | |
rm -rf /opt/hostedtoolcache | |
- name: Set version | |
# Always use git tags as semantic release can fail due to rate limit | |
run: | | |
git fetch --prune --unshallow | |
echo "RELEASE_VERSION=$(git describe --abbrev=0 --tags | sed -e 's/^v//')" >> $GITHUB_ENV | |
- name: Set up Docker Buildx #must be executed before a step that contains platforms | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Login to Amazon ECR Public | |
id: login-ecr-public | |
uses: aws-actions/amazon-ecr-login@v2 | |
with: | |
registry-type: public | |
- name: Publish Minimal Image to Dockerhub & ECR Public | |
env: | |
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }} | |
REGISTRY_ALIAS: k4y9r6y5 | |
REPOSITORY: canary-checker | |
IMAGE_TAG: "v${{ env.RELEASE_VERSION }}" | |
run: | | |
docker buildx create --use | |
docker buildx build \ | |
--cache-from=docker.io/flanksource/$REPOSITORY:latest \ | |
--platform linux/amd64,linux/arm64 \ | |
-t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG \ | |
-t docker.io/flanksource/$REPOSITORY:$IMAGE_TAG \ | |
-t docker.io/flanksource/$REPOSITORY:latest \ | |
-f build/minimal/Dockerfile \ | |
--push \ | |
. | |
- name: Publish Full Image to Dockerhub & ECR Public | |
env: | |
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }} | |
REGISTRY_ALIAS: k4y9r6y5 | |
REPOSITORY: canary-checker-full | |
IMAGE_TAG: "v${{ env.RELEASE_VERSION }}" | |
run: | | |
docker buildx create --use | |
docker buildx build \ | |
--platform linux/amd64,linux/arm64 \ | |
--cache-from=docker.io/flanksource/$REPOSITORY:latest \ | |
-t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG \ | |
-t docker.io/flanksource/$REPOSITORY:$IMAGE_TAG \ | |
-t docker.io/flanksource/$REPOSITORY:latest \ | |
-f build/full/Dockerfile \ | |
--push \ | |
. | |
helm: | |
runs-on: ubuntu-latest | |
needs: [semantic-release, docker] | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- 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 | |
# Always use git tags as semantic release can fail due to rate limit | |
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 image tags | |
run: ./yq -i e '.image.tag = "v${{ env.RELEASE_VERSION }}"' chart/values.yaml | |
- name: Set up Helm | |
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5 | |
with: | |
version: v3.8.0 | |
- name: Package Helm chart | |
run: | | |
make chart | |
- name: Clone charts repo | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
with: | |
repository: "${{ github.repository_owner }}/charts" | |
path: charts | |
token: "${{ secrets.FLANKBOT }}" | |
- name: Update chart repo | |
run: | | |
cd charts | |
cp ../canary-checker-*.tgz ./ | |
helm repo index --merge index.yaml . | |
- name: Push changes to chart repo | |
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # v5.0.0 | |
with: | |
commit_message: "Release ${{ needs.semantic-release.outputs.release-version }} of ${{ github.repository }}" | |
branch: gh-pages | |
repository: ./charts | |
update-incident-commander-chart: | |
runs-on: ubuntu-latest | |
needs: [helm, semantic-release] | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Set version | |
# Always use git tags as semantic release can fail due to rate limit | |
run: | | |
git fetch --prune --unshallow | |
echo "RELEASE_VERSION=$(git describe --abbrev=0 --tags | sed -e 's/^v//')" >> $GITHUB_ENV | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
with: | |
repository: "${{ github.repository_owner }}/incident-commander-chart" | |
token: ${{ secrets.FLANKBOT }} | |
path: ./incident-commander-chart | |
- name: Install yq | |
run: | | |
wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -O - |\ | |
tar xz && sudo mv ${BINARY} /usr/bin/yq | |
env: | |
VERSION: v4.25.1 | |
BINARY: yq_linux_amd64 | |
- name: Update canary-checker version in Incident-commander-chart | |
run: | | |
cd ./incident-commander-chart | |
yq eval-all -i '(.dependencies[] | select(.name == "canary-checker")) ref $d | $d.version = "${{ env.RELEASE_VERSION }}"' chart/Chart.yaml | |
yq eval-all -i '(.dependencies[] | select(.name == "canary-checker")) ref $d | $d.version = "${{ env.RELEASE_VERSION }}"' agent-chart/Chart.yaml | |
- name: Push changes to chart repo | |
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # v5.0.0 | |
with: | |
commit_message: "chore: update canary-checker chart dependency to ${{ env.RELEASE_VERSION }}" | |
repository: ./incident-commander-chart |