From 0b76c059ad6908f3bdae35a3d0aed61df8474094 Mon Sep 17 00:00:00 2001 From: Vadim Gedz Date: Thu, 27 Jun 2024 20:20:06 +0300 Subject: [PATCH] chore: add docker image to release automation (#6) --- .github/workflows/release.yaml | 24 ++++++++++++++++++++++++ Dockerfile | 5 +++++ package-lock.json | 4 ++-- package.json | 2 +- src/migrate.ts | 2 +- 5 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 Dockerfile diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3aaf3e5..793a2da 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -15,6 +15,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + - name: Install Node.js uses: actions/setup-node@v3 with: @@ -30,3 +34,23 @@ jobs: uses: JS-DevTools/npm-publish@v3 with: token: ${{ secrets.NPM_TOKEN }} + + - name: Login to Github Packages + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GHCR_PAT }} + + - name: Prepare version from tag + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + + - name: Build image and push to GitHub Container Registry + uses: docker/build-push-action@v5 + with: + context: . + tags: | + ghcr.io/shini4i/clickhouse-migrations:${{ github.ref_name }} + push: true + build-args: | + VERSION=${{ env.VERSION }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..78fb8d8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +ARG VERSION + +FROM node:22-alpine + +RUN npm install --global @shini4i/clickhouse-migrations@${VERSION} diff --git a/package-lock.json b/package-lock.json index 5096d96..d14dd17 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@shini4i/clickhouse-migrations", - "version": "0.1.14", + "version": "0.1.15", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@shini4i/clickhouse-migrations", - "version": "0.1.14", + "version": "0.1.15", "license": "MIT", "dependencies": { "@clickhouse/client": "^1.2.0", diff --git a/package.json b/package.json index 00a3f9a..c4fe522 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@shini4i/clickhouse-migrations", - "version": "0.1.14", + "version": "0.1.15", "description": "ClickHouse Migrations", "bin": { "clickhouse-migrations": "lib/cli.js" diff --git a/src/migrate.ts b/src/migrate.ts index 37e60e6..a37aa18 100644 --- a/src/migrate.ts +++ b/src/migrate.ts @@ -240,7 +240,7 @@ const migration = async ( const migrate = () => { const program = new Command(); - program.name('clickhouse-migrations').description('ClickHouse migrations.').version('0.1.13'); + program.name('clickhouse-migrations').description('ClickHouse migrations.').version('0.1.15'); program .command('migrate')