Skip to content

Migrate to GitHub Actions #8

Migrate to GitHub Actions

Migrate to GitHub Actions #8

Workflow file for this run

name: Docker
on:
push:
branches:
- main
tags:
- '*.*.*'
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- name: Restore
run: npm install
- name: Build
run: npm run build
- name: Lint
run: npm run lint
- name: Test
run: npm test
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: btburnett3/couchbase-index-manager
- name: Docker Build
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Publish to NPM
if: startsWith(github.ref, 'refs/tags/') # Only on tags
run: |
npm run lerna -- version ${{ env.RELEASE_VERSION }} --no-git-tag-version --exact -y &&
pushd packages/couchbase-index-manager && npm publish && popd &&
pushd packages/couchbase-index-manager-cli && npm publish && popd
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}