Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
Switch to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
steersbob committed Mar 24, 2023
1 parent ad44db4 commit 3c5ea2a
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 90 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI build

on:
push:
branches: ["**"]
pull_request:
branches: [develop, edge]

jobs:
build:
if: github.repository_owner == 'BrewBlox'
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: actions/setup-node@v3
with:
node-version: 16

- name: Set tag variable
run: |
echo "TAG=$(echo "${{ github.ref_name }}" | tr '/' '-' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "NPM_VERSION=$(node -pe "require('./package.json').version")" >> $GITHUB_ENV
- name: Get image metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/brewblox/node-red

- name: ghcr.io login
uses: docker/login-action@v2
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: NPM login
if: github.event_name != 'pull_request'
run: |
npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_AUTH_TOKEN }}
- run: yarn install
- run: yarn lint
- run: yarn test
- run: yarn build

- name: Build Docker image
uses: docker/build-push-action@v4
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
context: .

- name: NPM publish
if: github.event_name != 'pull_request'
run: |
npm publish --tag ${{ env.TAG }} || npm dist-tag add node-red-contrib-brewblox@${{ env.NPM_VERSION }} ${{ env.TAG }}
- name: NPM tag latest
if: github.event_name != 'pull_request' && github.ref_name == 'edge'
run: |
npm dist-tag add node-red-contrib-brewblox@${{ env.NPM_VERSION }} latest
90 changes: 0 additions & 90 deletions azure-pipelines.yml

This file was deleted.

0 comments on commit 3c5ea2a

Please sign in to comment.