Skip to content

Commit

Permalink
Manage auto-updates with renovate (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
bonddim authored May 10, 2024
1 parent 79ccd7e commit 4322fcd
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 40 deletions.
11 changes: 0 additions & 11 deletions .github/dependabot.yaml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
":disableDependencyDashboard"
],
"automerge": true,
"automergeStrategy": "squash",
"enabledManagers": [
"dockerfile",
"github-actions",
"custom.regex"
],
"customManagers": [
{
"customType": "regex",
"description": "Update sqlcmd version",
"datasourceTemplate": "github-releases",
"depNameTemplate": "microsoft/go-sqlcmd",
"fileMatch": [
"^Dockerfile$",
"^version$"
],
"matchStrings": [
"(?:ARG )?SQLCMD_VERSION=(?<currentValue>.+?)\\s"
]
}
]
}
6 changes: 0 additions & 6 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ on:
release:
types: [published]

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

permissions:
packages: write

Expand Down Expand Up @@ -55,5 +51,3 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64,linux/s390x
push: ${{ github.event_name == 'release' }}
build-args: |
VERSION=${{ github.event_name == 'release' && github.ref_name || 'v1.6.0' }}
30 changes: 9 additions & 21 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,27 @@
# The workflow is used to check for new releases of the microsoft/go-sqlcmd tool.
# If a new release is available, the workflow creates a new release in the current repository.

# The workflow is used to publish new release on every "version" file change.
name: Release

on:
schedule:
- cron: '0 0,12 * * *'
push:
branches: [main]
paths: [version]

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/create-github-app-token@v1
id: app
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}

- name: Check releases
id: check
env:
GH_TOKEN: ${{ steps.app.outputs.token }}
run: |
latest() { gh release list -R ${1} --exclude-pre-releases --limit 1 --json tagName --jq '.[] | .tagName'; }
echo image=$(latest "${{ github.repository }}") | tee -a $GITHUB_OUTPUT
echo tool=$(latest "microsoft/go-sqlcmd") | tee -a $GITHUB_OUTPUT
- name: Create release
if: ${{ steps.check.outputs.tool != steps.check.outputs.image }}
env:
GH_TOKEN: ${{ steps.app.outputs.token }}
run: |
echo "Creating release for ${{ steps.check.outputs.tool }}"
gh release create ${{ steps.check.outputs.tool }} \
--latest \
--title ${{ steps.check.outputs.tool }} \
--notes "Check https://github.com/microsoft/go-sqlcmd/releases/tag/${{ steps.check.outputs.tool }}" \
--repo ${{ github.repository }}
set -u
. version
echo "Creating release for ${SQLCMD_VERSION}"
gh release create ${SQLCMD_VERSION} --latest
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM --platform=${BUILDPLATFORM} alpine:3 AS tools
ARG VERSION
ARG SQLCMD_VERSION=v1.6.0
ARG TARGETARCH
RUN wget -c https://github.com/microsoft/go-sqlcmd/releases/download/${VERSION}/sqlcmd-${VERSION}-linux-${TARGETARCH}.tar.bz2 -O - | tar -xj
RUN wget -c https://github.com/microsoft/go-sqlcmd/releases/download/${SQLCMD_VERSION}/sqlcmd-${SQLCMD_VERSION}-linux-${TARGETARCH}.tar.bz2 -O - | tar -xj

FROM gcr.io/distroless/static:nonroot
COPY --from=tools /sqlcmd /sqlcmd
Expand Down
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SQLCMD_VERSION=v1.6.0

0 comments on commit 4322fcd

Please sign in to comment.