Skip to content

chore(deps): bump the npm-dependencies group with 11 updates #27272

chore(deps): bump the npm-dependencies group with 11 updates

chore(deps): bump the npm-dependencies group with 11 updates #27272

Workflow file for this run

name: Build and publish Docker
on:
push:
branches:
- '**'
tags-ignore:
- '*'
workflow_dispatch: ~
env:
CACHE_REGISTRY: ghcr.io
CACHE_REPO: linode/apl-core
REPO: linode/apl-core
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_LINODEBOT_TOKEN }}
DOCKER_USERNAME: ${{ vars.DOCKERHUB_LINODEBOT_USERNAME }}
DEV_KUBECONFIG_64: ${{ secrets.DEV_KUBECONFIG }}
BOT_EMAIL: ${{ vars.BOT_EMAIL }}
BOT_USERNAME: ${{ vars.BOT_USERNAME }}
COMMIT_SHA: ${{ github.sha }}
jobs:
build-test-cache:
if: (!contains(github.event.head_commit.message, 'ci skip') && !startsWith(github.ref, 'refs/tags/') && !github.event.act)
runs-on: ubuntu-22.04
steps:
- name: Set env
run: |
tag=${GITHUB_REF##*/}
echo "Creating tag: $tag"
echo "TAG=$tag" >> $GITHUB_ENV
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
revision=${{ env.COMMIT_SHA }}
echo "Setting apps revision to: $revision"
echo "APPS_REVISION=$revision" >> $GITHUB_ENV
else
echo "Leaving apps revision empty"
fi
git config --global user.email $BOT_EMAIL
git config --global user.name $BOT_USERNAME
- name: Checkout
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Github Packages
uses: docker/login-action@v4
with:
registry: ${{ env.CACHE_REGISTRY }}
username: ${{ env.BOT_USERNAME }}
password: '${{ secrets.BOT_TOKEN }}'
- name: CI tests, image build and push tag for main or branch
uses: docker/build-push-action@v7
with:
push: true
build-args: |
APPS_REVISION=${{ env.APPS_REVISION }}
context: .
tags: |
${{ env.CACHE_REGISTRY }}/${{ env.CACHE_REPO }}:${{ env.TAG }}
push-to-docker:
needs: build-test-cache
if: always() && ((contains(needs.build-test-cache.result, 'success') && !contains(needs.integration.outputs.started, 'true')) || (contains(needs.integration.result, 'success'))) && !github.event.act && github.actor != 'dependabot[bot]'
runs-on: ubuntu-22.04
steps:
- name: Push to docker hub
run: |
set -u
TAG=${GITHUB_REF##*/}
docker login ghcr.io -u $BOT_USERNAME -p ${{ secrets.BOT_TOKEN }}
image="$CACHE_REGISTRY/$CACHE_REPO:$TAG"
docker pull $image
docker tag $image $REPO:$TAG
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker push $REPO:$TAG
- name: Show me the logic
run: |
echo github.ref == ${{ github.ref }}
deploy-to-dev:
needs: push-to-docker
if: always() && (startsWith(github.ref, 'refs/heads/main')) && !github.event.act
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Deploy to dev
run: ci/scripts/trigger_dev.sh
release:
needs: push-to-docker
if: always() && (startsWith(github.ref, 'refs/heads/releases/') || startsWith(github.ref, 'refs/heads/main')) && startsWith(github.event.head_commit.message, 'chore(release)') && !github.event.act
runs-on: ubuntu-22.04
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set env
run: |
git config --global user.email $BOT_EMAIL
git config --global user.name $BOT_USERNAME
- name: Create and push git tag
id: git_tag
run: |
TAG=${GITHUB_REF##*/}
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker pull $REPO:$TAG
docker tag $REPO:$TAG $REPO:latest
docker push $REPO:latest
release_tag=v$(jq -r '.version' < package.json)
echo tag=$release_tag >> $GITHUB_OUTPUT
echo "Releasing $REPO:$release_tag"
docker tag $REPO:$TAG $REPO:$release_tag
docker push $REPO:$release_tag
docker login -u $BOT_USERNAME -p '${{ secrets.BOT_TOKEN }}' ghcr.io
docker tag $REPO:$TAG $CACHE_REGISTRY/$CACHE_REPO:$release_tag
docker push $CACHE_REGISTRY/$CACHE_REPO:$release_tag
echo "machine github.com login ${{ env.BOT_USERNAME }} password ${{ secrets.BOT_TOKEN }}" > ~/.netrc
git tag -am "$COMMIT_MSG" $release_tag && git push --follow-tags
# Cut the CHANGELOG.md file up to the second occurence of the line starting with `## [` (meaning two #, a space,a square bracket).
# This way we always get the changes of the latest patch (if any) and the latest minor.
awk '/^## \[/{count++; if(count==2) exit} {print}' CHANGELOG.md > NEW_CHANGELOG.md
- name: Create GitHub release
uses: ncipollo/release-action@v1.21.0
env:
token: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ steps.git_tag.outputs.tag }}
name: Release ${{ steps.git_tag.outputs.tag }}
bodyFile: 'NEW_CHANGELOG.md'
generateReleaseNotes: true
chart-release:
needs: release
if: always() && contains(needs.release.result, 'success') && !github.event.act
runs-on: ubuntu-22.04
container:
image: linode/apl-tools:v2.10.6
options: --user 0 # See https://docs.github.com/en/actions/sharing-automations/creating-actions/dockerfile-support-for-github-actions#user
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Prepare chart
id: prepare_chart
run: |
# Install and update helm repo
helm repo add apl https://linode.github.io/apl-core
helm repo update
# Retrieve the app version from package.json
app_version=$(jq -r '.version' package.json)
if [ -z "$app_version" ]; then
echo "Error: Could not retrieve app version from package.json"
exit 1
fi
# Extract major and minor from the app version
new_app_major=$(echo "$app_version" | cut -d '.' -f 1)
new_app_minor=$(echo "$app_version" | cut -d '.' -f 2)
# Get existing helm charts in the registry
helm_output=$(helm search repo otomi -l -o json)
# Use jq to parse the output and find the latest version for the given $new_app_major.$new_app_minor app version
existing_version=$(echo "$helm_output" | jq -r --arg major "$new_app_major" --arg minor "$new_app_minor" '
map(select(.app_version | startswith("v\($major).\($minor)"))) |
max_by(.version | split(".") | map(tonumber)) |
.version'
)
# Update Chart.yaml and values.yaml with the new app version
sed -i "s/0.0.0-chart-version/$app_version/g" chart/apl/Chart.yaml
sed -i "s/APP_VERSION_PLACEHOLDER/v$app_version/g" chart/apl/Chart.yaml
echo "Chart and values files updated successfully with version $app_version"
# Copy readme from repo into the charts and add tpl/chart-values.md
cp README.md chart/apl/
printf "\n\n" >>chart/apl/README.md
cat tpl/chart-values.md >>chart/apl/README.md
# Generate schema
npx js-yaml values-schema.yaml > chart/apl/values.schema.json
# Set the global id for git as it seems needed by the next step when a custom image is used
git config --global user.email ${{ env.BOT_EMAIL }}
git config --global user.name ${{ env.BOT_USERNAME }}
#TODO: Use the same user id on the container as in the runner to avoid the "dubious ownership" error
- name: Mark repository as safe for Git
run: git config --global --add safe.directory /__w/apl-core/apl-core
- name: Create and publish otomi chart release
id: chart_release
uses: helm/chart-releaser-action@v1.7.0
with:
charts_dir: chart
skip_existing: true
mark_as_latest: false
env:
CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
# notification:
# needs: [build-test-cache, push-to-docker, release, chart-release]
# if: always()
# runs-on: ubuntu-22.04
# steps:
# - name: Slack Notification
# uses: rtCamp/action-slack-notify@v2
# env:
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
# SLACK_CHANNEL: github-ci
# SLACK_COLOR: ${{ job.status }}
# SLACK_ICON: https://github.com/redkubes.png?size=48
# SLACK_TITLE: CI run
# SLACK_USERNAME: RedKubesBot