Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Github Actions and fix build #35

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading