This repository has been archived by the owner on Jun 21, 2024. It is now read-only.
Update README.md #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |