Skip to content

Commit

Permalink
fix: reference the plugin metadata when doing boilerplate logging
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexStormwood committed Mar 26, 2024
1 parent ecea5f8 commit e232442
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 2 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/generateRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Generate output for download

on:
push:
branches:
- main
workflow_dispatch:

jobs:
draft_release:
permissions:
contents: write
name: Create Draft Release
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.create_release.outputs.id }}
release_version: ${{ steps.tag.outputs.new_tag }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
semver_commit_hash: ${{ steps.semver_commit.outputs.commit_hash }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main

- name: Bump version and push tag
id: tag
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: "minor"

- name: Bump package.json version
id: npm-version
uses: reedyuk/npm-version@master
with:
version: ${{ steps.tag.outputs.new_version }}

- name: Commit semver changes to repo
id: semver_commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main


- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
tag_name: ${{ steps.tag.outputs.new_tag }}
name: ${{ steps.tag.outputs.new_tag }}
body: ${{ steps.tag.outputs.changelog }}
draft: true
prerelease: false

generate_output:
needs: [draft_release]
name: Gather plugin code
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.draft_release.outputs.semver_commit_hash }}

- name: Set up NodeJS
uses: actions/setup-node@v4
with:
node-version: lts/*


- name: Upload Output to Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.draft_release.outputs.release_version }}
draft: true

make_release:
needs: [draft_release, generate_output]
name: Publish the Draft Release
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub Action
uses: actions/checkout@v4

- name: Mark release as published
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.draft_release.outputs.release_id }}
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
console.log(`Sourcepool plugin ${process.env.npm_package_name} loading.`);
const scopedPackageJson = require('../package.json');

console.log(`Sourcepool plugin ${scopedPackageJson.name} loading.`);


console.debug(JSON.stringify({
Expand All @@ -7,4 +9,4 @@ console.debug(JSON.stringify({
serverPluginsDirectory: global.serverPlugins || "No server plugins path available."
}, null, 4));

console.log(`Sourcepool plugin ${process.env.npm_package_name} completed loading.`)
console.log(`Sourcepool plugin ${scopedPackageJson.name} completed loading.`)

0 comments on commit e232442

Please sign in to comment.