Skip to content

Commit 2c99ce7

Browse files
committed
Rm Publish
1 parent 7bd9dd9 commit 2c99ce7

4 files changed

Lines changed: 73 additions & 108 deletions

File tree

.github/workflows/1-build.yml

Lines changed: 0 additions & 104 deletions
This file was deleted.

.github/workflows/1-release.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: 01 - Release Action
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
run-name: Release Action - ${{ github.actor }}
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
id-token: write # Required for signing the tag
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0 # Required to get previous tags
23+
24+
- name: Set up Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 20
28+
29+
- name: Install dependencies
30+
run: npm install
31+
32+
- name: Build
33+
run: npm run build
34+
35+
- name: Commit dist
36+
run: |
37+
git config --local user.email "action@github.com"
38+
git config --local user.name "github-actions[bot]"
39+
git config set advice.addIgnoredFile false
40+
git add dist/
41+
git commit -m "chore: update distributed files" || echo "No changes to commit"
42+
git push
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Check if version has changed
47+
id: check_version
48+
run: |
49+
CURRENT_VERSION=$(node -p "require('./package.json').version")
50+
echo CURRENT_VERSION=$CURRENT_VERSION >> "$GITHUB_OUTPUT"
51+
echo "Current version: $CURRENT_VERSION"
52+
PREVIOUS_TAG=$(git describe --abbrev=0 --tags 2>/dev/null || echo '')
53+
echo "Previous tag: $PREVIOUS_TAG"
54+
if [[ "$PREVIOUS_TAG" == "v$CURRENT_VERSION" ]]; then
55+
echo "changed=false" >> "$GITHUB_OUTPUT"
56+
echo "Version has not changed, skipping tag creation"
57+
else
58+
echo "changed=true" >> "$GITHUB_OUTPUT"
59+
echo "Version has changed, will create tag"
60+
fi
61+
env:
62+
GITHUB_OUTPUT: ${{ github.action_path }}/output.env
63+
64+
- name: Create Git tag
65+
if: steps.check_version.outputs.changed == 'true'
66+
run: |
67+
TAG_NAME="v${{ steps.check_version.outputs.CURRENT_VERSION }}"
68+
git config --global user.email "renan-alm@github.com"
69+
git config --global user.name "Renan Alm"
70+
git tag -a "$TAG_NAME" -m "Release $TAG_NAME"
71+
git push origin "$TAG_NAME"
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Action JS Template
22

3-
[![Build Status](https://github.com/renan-alm/js-action-demo/actions/workflows/1-build.yml/badge.svg)](https://github.com/renan-alm/js-action-demo/actions/workflows/1-build.yml)
43
[![Test](https://github.com/renan-alm/js-action-demo/actions/workflows/2-test-action.yml/badge.svg)](https://github.com/renan-alm/js-action-demo/actions/workflows/2-test-action.yml)
54
[![License](https://img.shields.io/github/license/renan-alm/js-action-demo)](LICENSE)
65
[![Issues](https://img.shields.io/github/issues/renan-alm/js-action-demo)](https://github.com/renan-alm/js-action-demo/issues)

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,5 @@
1616
},
1717
"devDependencies": {
1818
"@vercel/ncc": "^0.38.0"
19-
},
20-
"publishConfig": {
21-
"registry": "https://npm.pkg.github.com/"
2219
}
2320
}

0 commit comments

Comments
 (0)