Skip to content

Commit

Permalink
Configure github actions to do npm @next releases
Browse files Browse the repository at this point in the history
Use tags with -pre postfix to run the workflow
Only run if current versions are different from published
  • Loading branch information
yamalight committed Nov 23, 2022
1 parent 672e0b6 commit 224cb57
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 25 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Prerelease

on:
# only run when tagged with VER-pre* tag
push:
tags:
- '*-pre*'
# only run if tests are finished
workflow_run:
workflows: ['Test']
branches: [main]
types:
- completed

jobs:
publish-client:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
# get versions for currently published and local packages
- name: check versions
id: versions
run: |
echo "current=$(npm info exoframe-client@next version || echo 'no published package yet')" >> $GITHUB_OUTPUT
echo "new=$(npm info ./packages/exoframe-client version)" >> $GITHUB_OUTPUT
# install and publish if local version is not the same as published
- name: install
if: ${{ steps.versions.outputs.current != steps.versions.outputs.new }}
run: npm ci
- name: publish
if: ${{ steps.versions.outputs.current != steps.versions.outputs.new }}
run: npm publish --access public --tag next -w exoframe-client
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-cli:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
# get versions for currently published and local packages
- name: check versions
id: versions
run: |
echo "current=$(npm info exoframe@next version || echo 'no published package yet')" >> $GITHUB_OUTPUT
echo "new=$(npm info ./packages/exoframe-cli version)" >> $GITHUB_OUTPUT
# install, build and publish if local version is not the same as published
- name: install
if: ${{ steps.versions.outputs.current != steps.versions.outputs.new }}
run: npm ci
- name: build
if: ${{ steps.versions.outputs.current != steps.versions.outputs.new }}
run: npm run build -w exoframe
- name: publish
if: ${{ steps.versions.outputs.current != steps.versions.outputs.new }}
run: npm publish --access public --tag next -w exoframe
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-server:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
# get versions for currently published and local packages
- name: check versions
id: versions
run: |
echo "current=$(npm info exoframe-server@next version || echo 'no published package yet')" >> $GITHUB_OUTPUT
echo "new=$(npm info ./packages/exoframe-server version)" >> $GITHUB_OUTPUT
# install and publish if local version is not the same as published
- name: install
if: ${{ steps.versions.outputs.current != steps.versions.outputs.new }}
run: npm ci
- name: publish
if: ${{ steps.versions.outputs.current != steps.versions.outputs.new }}
run: npm publish --access public --tag next -w exoframe-server
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
30 changes: 20 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/exoframe-cli/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
lib/
dist/
test/fixtures/config-test/exoframe.json
14 changes: 9 additions & 5 deletions packages/exoframe-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"name": "exoframe",
"version": "7.0.0",
"description": "Exoframe is a self-hosted tool that allows simple one-command deployments using Docker",
"main": "src/index.js",
"version": "7.0.0-pre+alpha.1",
"description": "CLI for Exoframe, self-hosted deployment tool",
"main": "dist/index.js",
"type": "module",
"repository": "[email protected]:exoframejs/exoframe.git",
"author": "Tim Ermilov <[email protected]>",
"license": "MIT",
"files": [
"dist/*"
],
"scripts": {
"build": "babel src --out-dir lib/ --watch",
"build": "ncc build index.js -o dist",
"lint": "eslint src/ test/",
"test": "TZ=Greenland NODE_ENV=testing FORCE_COLOR=false vitest",
"test:ci": "TZ=Greenland NODE_ENV=testing FORCE_COLOR=false vitest run --coverage"
Expand All @@ -18,7 +21,7 @@
"chalk": "^5.0.1",
"cli-table3": "^0.6.3",
"commander": "^9.3.0",
"exoframe-client": "^7.0.0",
"exoframe-client": "^7.0.0-pre",
"got": "^12.1.0",
"inquirer": "^9.1.0",
"lodash": "^4.17.21",
Expand All @@ -27,6 +30,7 @@
"pretty-bytes": "^6.0.0"
},
"devDependencies": {
"@vercel/ncc": "^0.34.0",
"@vitest/coverage-c8": "^0.25.1",
"c8": "^7.11.3",
"eslint": "^8.1.0",
Expand Down
7 changes: 3 additions & 4 deletions packages/exoframe-client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "exoframe-client",
"version": "7.0.0",
"description": "Exoframe is a self-hosted tool that allows simple one-command deployments using Docker",
"version": "7.0.0-pre+alpha.1",
"description": "API client for Exoframe server, self-hosted deployment tool",
"main": "index.js",
"repository": "[email protected]:exoframejs/exoframe.git",
"author": "Tim Ermilov <[email protected]>",
Expand All @@ -10,8 +10,7 @@
"scripts": {
"lint": "eslint src/",
"test": "TZ=Greenland NODE_ENV=testing vitest",
"test:ci": "TZ=Greenland NODE_ENV=testing vitest run --coverage",
"coveralls": "cat ./coverage/lcov.info | coveralls"
"test:ci": "TZ=Greenland NODE_ENV=testing vitest run --coverage"
},
"dependencies": {
"got": "^12.1.0",
Expand Down
3 changes: 0 additions & 3 deletions packages/exoframe-server/index.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/exoframe-server/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "exoframe-server",
"version": "7.0.0",
"description": "Exoframe is a self-hosted tool that allows simple one-command deployments using Docker",
"version": "7.0.0-pre+alpha.1",
"description": "Exoframe server, a self-hosted deployment tool",
"main": "src/index.js",
"bin": "bin/exoframe-server.js",
"type": "module",
Expand Down

0 comments on commit 224cb57

Please sign in to comment.