Skip to content

Commit

Permalink
Split Docker and NPM workflows.
Browse files Browse the repository at this point in the history
Allow docker workflow to be ran in self-hosted machine to bypass build performance issues while I figure out a more permanet solution
  • Loading branch information
nicomt committed Mar 3, 2024
1 parent 1b57f6a commit 866f906
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,23 @@ name: CI

on:
workflow_dispatch:
inputs:
chosen-runner:
description: 'Choose the runner to use'
required: true
type: choice
default: 'ubuntu-latest'
options:
- 'ubuntu-latest'
- 'self-hosted'
push:
tags:
- 'v*'

env:
DOCKER_IMAGE: nicomt/ckron
jobs:

publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

publish-docker:
needs: publish-npm
runs-on: ubuntu-latest
runs-on: ${{ github.event_name == 'push' && 'ubuntu-latest' || inputs.chosen-runner }}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v1
Expand All @@ -33,7 +28,7 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: nicomt/ckron
images: ${{ env.DOCKER_IMAGE }}

-
name: Login to DockerHub
Expand All @@ -50,5 +45,7 @@ jobs:
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.DOCKER_IMAGE }}:buildcache
cache-to: type=registry,ref=${{ env.DOCKER_IMAGE }}:buildcache,mode=max


25 changes: 25 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js Package

on:
workflow_dispatch:
push:
tags:
- 'v*'

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run lint
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

0 comments on commit 866f906

Please sign in to comment.