Skip to content

Commit

Permalink
Split githuub actions into 2 separate workflows and fixed build (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
CEbbinghaus authored Sep 4, 2024
1 parent 862055a commit 53c9c08
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 37 deletions.
49 changes: 13 additions & 36 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
on:
workflow_dispatch:
pull_request:
paths:
- 'lib/**'
- 'backend/**'
- 'src/**'
- 'docs/**'
- 'util/**'
push:
branches: master
paths:
- 'lib/**'
- 'backend/**'
- 'src/**'
- 'docs/**'

jobs:
build:
Expand Down Expand Up @@ -46,39 +58,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: "MicroSDeck"
path: release/*

deploy:
if: github.ref == 'refs/heads/master'
needs: build
name: Deploy Package
runs-on: ubuntu-latest
permissions:
packages: write
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: jdx/mise-action@v2

- name: create .npmrc
run: |
echo "//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}
registry=https://registry.npmjs.org/
always-auth=true" > ~/.npmrc
- name: Update Version
run: |
echo -n "-$(git rev-parse --short HEAD)" >> backend/version && \
node util/versioning.mjs update package.json lib/package.json
- name: Install, Build & Publish
working-directory: lib
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
run: |
pnpm install && \
pnpm build && \
pnpm publish --no-git-checks --tag prerelease
path: release/*
38 changes: 38 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
push:
branches: [master]
paths:
- 'lib/**'

jobs:
deploy:
name: Deploy Package
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: jdx/mise-action@v2

- name: create .npmrc
run: |
echo "//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}
registry=https://registry.npmjs.org/
always-auth=true" > ~/.npmrc
- name: Update Version
run: |
echo -n "-$(git rev-parse --short HEAD)" >> backend/version && \
node util/versioning.mjs update package.json lib/package.json
- name: Install, Build & Publish
working-directory: lib
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
run: |
pnpm install && \
pnpm build && \
pnpm publish --no-git-checks --tag prerelease
4 changes: 3 additions & 1 deletion util/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { Version, UpdateVersion, ResetVersion } from './versioning.mjs';
import { Logger } from './log.mjs';
import { exit } from 'process';

import { name as PluginName } from "../plugin.json" with { type: "json" };
import plugin from "../plugin.json" with { type: "json" };
const { name: PluginName } = plugin;

import deploy from "../deploy.json" with { type: "json" };

if (process.argv.includes('-h') || process.argv.includes('--help')) {
Expand Down

0 comments on commit 53c9c08

Please sign in to comment.