Skip to content

Commit

Permalink
Publish (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
iam-medvedev authored Nov 26, 2023
1 parent 75998f7 commit cf9a44e
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 1 deletion.
1 change: 0 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: publish

on:
push:
branches:
- main

jobs:
publish:
runs-on: ubuntu-latest

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

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Get published version
id: get_published_version
run: |
published_version=$(npm show chrome-devtools-built version || echo "0.0.0")
IFS='.' read -r major date patch <<< "$published_version"
echo "date=${date}" >> $GITHUB_OUTPUT
echo "patch=${patch}" >> $GITHUB_OUTPUT
- name: Create new version
id: create_new_version
run: |
current_date=$(date +"%Y%d%m")
if [ "${{ steps.get_published_version.outputs.date }}" != "$current_date" ]; then
new_version="1.${current_date}.0"
else
new_patch=$(( ${{ steps.get_published_version.outputs.patch }} + 1 ))
new_version="1.${current_date}.${new_patch}"
fi
echo "new_version=${new_version}" >> $GITHUB_OUTPUT
- name: Update package version
run: |
echo "Updating package version to ${{ steps.create_new_version.outputs.new_version }}"
npm version ${{ steps.create_new_version.outputs.new_version }} --allow-same-version
- name: Create git release
run: |
git tag -a v${{ steps.create_new_version.outputs.new_version }} -m "Release v${{ steps.create_new_version.outputs.new_version }}"
git push origin v${{ steps.create_new_version.outputs.new_version }}
- name: Publish
run: npm publish --dry-run
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
!README.md
!public
!public/**/*
!package.json
!yarn.lock
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ This repository contains a [GitHub Action](.github/workflows/build.yml) that run

For your hack needs there is a [deployed version](https://iam-medvedev.github.io/chrome-devtools/) which will be updated after each build.

## NPM version

[![npm version](https://badge.fury.io/js/chrome-devtools-built.svg)](https://www.npmjs.com/package/chrome-devtools-built)

Also every build is published in the NPM.

Package versioning works as follows: `1.20232611.0` where `1.${current_date}.{patch_number}`.

## License

The [devtools-frontend](https://chromium.googlesource.com/devtools/devtools-frontend) code is subject to its own license terms. Please refer to the [Chromium DevTools Frontend License](https://chromium.googlesource.com/devtools/devtools-frontend/+/main/LICENSE) for details.
Expand Down
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "chrome-devtools-built",
"version": "0.0.0",
"description": "chrome-devtools-frontend built version",
"repository": "https://github.com/iam-medvedev/chrome-devtools.git",
"author": "Ilya Medvedev <[email protected]>",
"license": "MIT",
"files": [
"public",
"README.md"
]
}
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


0 comments on commit cf9a44e

Please sign in to comment.