fix(frontend): fix resource type in automate command (#3134) #76
Workflow file for this run
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 Tracetest | |
permissions: | |
contents: write | |
concurrency: | |
group: "release-version" | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
build-web: | |
name: build web | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: npm | |
cache-dependency-path: web/package-lock.json | |
- name: Cache Build | |
id: cache-build | |
uses: actions/cache@v3 | |
with: | |
path: web/build/ | |
key: web-build-${{ hashFiles('web/*') }} | |
- run: cd web; npm ci | |
if: steps.cache-build.outputs.cache-hit != 'true' | |
- run: cd web; CI= npm run build | |
if: steps.cache-build.outputs.cache-hit != 'true' | |
- name: Upload assets | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tracetest-web | |
path: web/build/ | |
release: | |
runs-on: ubuntu-latest | |
needs: [build-web] | |
env: | |
DOCKER_CLI_EXPERIMENTAL: "enabled" | |
GORELEASER_KEY: ${{ secrets.GORELEASER_LICENSE }} | |
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }} | |
FURY_TOKEN: ${{ secrets.FURY_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# fix for this issue: https://github.com/goreleaser/goreleaser/issues/1163 | |
- name: Configure Goreleaser Tags | |
shell: bash | |
run: | | |
prevTag=$(git describe --tags --abbrev=0 v0.11.1^ --exclude='*-rc.*') | |
echo "GORELEASER_CURRENT_TAG=${{ github.ref_name}}" >> $GITHUB_ENV | |
echo "GORELEASER_PREVIOUS_TAG="$prevTag >> $GITHUB_ENV | |
- name: debug info | |
shell: bash | |
run: | | |
echo "GORELEASER_CURRENT_TAG: "$GORELEASER_CURRENT_TAG | |
echo "GORELEASER_PREVIOUS_TAG: "$GORELEASER_PREVIOUS_TAG | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
if: github.event_name != 'pull_request' | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Setup go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: 'go.work' | |
cache: true | |
cache-dependency-path: go.work | |
- uses: actions/download-artifact@v3 | |
with: | |
name: tracetest-web | |
path: web/build/ | |
# release | |
- uses: goreleaser/goreleaser-action@v4 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
distribution: goreleaser-pro | |
version: v1.19.2 | |
args: release --clean | |
env: | |
VERSION: ${{ github.ref_name}} | |
TRACETEST_ENV: main | |
ANALYTICS_FE_KEY: ${{ secrets.ANALYTICS_FE_KEY }} | |
ANALYTICS_BE_KEY: ${{ secrets.ANALYTICS_BE_KEY }} | |
helm_chart_version_bump: | |
name: "Trigger Helm chart appVersion update" | |
needs: "release" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
repository: "kubeshop/helm-charts" | |
ref: "main" | |
fetch-depth: 0 | |
token: ${{ secrets.CI_BOT_TOKEN }} | |
- name: Install Helm | |
uses: azure/setup-helm@v1 | |
with: | |
version: v3.4.0 | |
- name: Bump up tracetest chart | |
run: | | |
# sets appVersion in the Chart.yaml | |
echo New appVersion: ${{ github.ref_name }} | |
sed -i -e "s/^appVersion: .*$/appVersion: \"${{ github.ref_name}}\"/" charts/tracetest/Chart.yaml | |
# Bumps charts patch version | |
CURRENT_VERSION=$(sed -n -e "s/^version: \(.*\)$/\1/p" charts/tracetest/Chart.yaml) | |
echo Current chart version ${CURRENT_VERSION} | |
NEW_VERSION=$(echo $CURRENT_VERSION |awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g') | |
echo New version ${NEW_VERSION} | |
sed -i -e "s/^version: .*/version: ${NEW_VERSION}/g" charts/tracetest/Chart.yaml | |
- name: Lint the chart | |
run: | | |
helm dependency update charts/tracetest | |
helm lint charts/tracetest | |
- name: Push updated chart | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
git remote -v | |
git add . | |
git commit -m "automatically updated tracetest related charts" | |
git push | |
- name: Slack Notification if the helm version bump succeeded | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_CHANNEL: tracetest | |
SLACK_COLOR: good | |
SLACK_ICON: https://github.githubassets.com/images/modules/site/features/actions-icon-actions.svg | |
SLACK_TITLE: Helm chart version bump succeeded :party_blob:! | |
SLACK_MESSAGE: "Tracetest chart version was bumped" | |
SLACK_USERNAME: GitHub | |
SLACK_LINK_NAMES: true | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_FOOTER: "Kubeshop --> Tracetest" | |
notify_slack_if_helm_chart_bump_fails: | |
runs-on: ubuntu-latest | |
needs: helm_chart_version_bump | |
if: always() && (needs.helm_chart_version_bump.result == 'failure') | |
steps: | |
- name: Slack Notification if Helm Release action failed | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_CHANNEL: tracetest | |
SLACK_COLOR: ${{ needs.helm_chart_version_bump.result }} | |
SLACK_ICON: https://github.githubassets.com/images/modules/site/features/actions-icon-actions.svg | |
SLACK_TITLE: Helm Chart version bump action failed :boom:! | |
SLACK_USERNAME: GitHub | |
SLACK_LINK_NAMES: true | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_FOOTER: "Kubeshop --> Tracetest" | |
chocolatey-release: | |
needs: release | |
name: Release on Chocolatey | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download newest version | |
id: cliDownload | |
shell: pwsh | |
run: | | |
$tag = $env:TAG | |
$version = $tag.trimStart("v") | |
echo "$version" | |
Invoke-Webrequest -URI "https://github.com/kubeshop/tracetest/releases/download/v${version}/tracetest_${version}_windows_amd64.tar.gz" -OutFile tracetest.tar.gz | |
$hash = Get-FileHash tracetest.tar.gz | Select -ExpandProperty Hash | |
echo '::echo::on' | |
echo "::set-output name=hash::$hash" | |
echo "::set-output name=version::$version" | |
env: | |
TAG: ${{ github.ref_name }} | |
- name: Generate release files | |
shell: pwsh | |
run: | | |
(Get-Content scripts/choco/tools/chocolateyinstall.ps1) -Replace '%checksum%', $env:PACKAGE_CHECKSUM | Set-Content scripts/choco/tools/chocolateyinstall.ps1 | |
(Get-Content scripts/choco/tracetest.nuspec) -Replace '%version%', $env:PACKAGE_VERSION | Set-Content scripts/choco/tracetest.nuspec | |
env: | |
PACKAGE_CHECKSUM: ${{ steps.cliDownload.outputs.hash }} | |
PACKAGE_VERSION: ${{ steps.cliDownload.outputs.version }} | |
- name: Pack and release | |
shell: pwsh | |
run: | | |
# install choco | |
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) | |
cd scripts/choco | |
choco pack | |
choco push --source https://chocolatey.kubeshop.io/chocolatey --api-key $env:CHOCOLATEY_API_KEY tracetest.$env:PACKAGE_VERSION.nupkg | |
env: | |
CHOCOLATEY_API_KEY: ${{ secrets.COMMOM_CHOCO_API_KEY }} | |
PACKAGE_VERSION: ${{ steps.cliDownload.outputs.version }} |