Skip to content

Commit

Permalink
chore: update github actions to remove ENV warnings
Browse files Browse the repository at this point in the history
Signed-off-by: hernan <[email protected]>
  • Loading branch information
littlespex authored and hernanr99 committed Feb 27, 2024
1 parent d1ae6b1 commit 69ecd3e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/publish-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ on:
description: "An id to append to the version. Defaults to the current timestamp"
type: string
required: false

env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
PKG_VERSION: ""
BUILD_ID: ""

jobs:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v3
with:
Expand All @@ -39,20 +41,20 @@ jobs:

- name: Test
run: npm test

- name: Get Version
run: echo "version=`node -p "require('./package').version"`" >> $GITHUB_ENV
run: echo "PKG_VERSION=`node -p "require('./package').version"`" >> $GITHUB_ENV

- name: Get Time
if: github.event.inputs.id == ''
run: echo "id=`date +%s`" >> $GITHUB_ENV
run: echo "BUILD_ID=`date +%s`" >> $GITHUB_ENV

- name: Get ID
if: github.event.inputs.id != ''
run: echo "id=${{ github.event.inputs.id }}" >> $GITHUB_ENV
run: echo "BUILD_ID=${{ github.event.inputs.id }}" >> $GITHUB_ENV

- name: Generate Version
run: npm version ${{ env.version }}-${{ github.event.inputs.tag }}.${{ env.id }} --no-git-tag-version
run: npm version ${{ env.PKG_VERSION }}-${{ github.event.inputs.tag }}.${{ env.BUILD_ID }} --no-git-tag-version

- name: Publish Tag
run: npm run pub --tag ${{ github.event.inputs.tag }}
11 changes: 6 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ on:

env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
PKG_VERSION: ""

jobs:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v3
with:
Expand All @@ -35,7 +36,7 @@ jobs:
run: npm run pub

- name: Get Version
run: echo "version=`node -p "require('./package').version"`" >> $GITHUB_ENV
run: echo "PKG_VERSION=`node -p "require('./package').version"`" >> $GITHUB_ENV

- name: Create Release Notes
run: npm run notes
Expand All @@ -45,8 +46,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS }}
with:
tag_name: v${{ env.version }}
release_name: ${{ env.version }}
tag_name: v${{ env.PKG_VERSION }}
release_name: ${{ env.PKG_VERSION }}
commitish: main
body_path: ./RELEASE.md
draft: true
Expand Down

0 comments on commit 69ecd3e

Please sign in to comment.