Skip to content

Commit

Permalink
ci: use env
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Hernandez Pellicer committed Feb 25, 2024
1 parent 3ab82d4 commit 0c98696
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/create-release-candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ jobs:
- uses: benjlevesque/[email protected]
id: short-sha
- name: Log details
env:
BRANCH: ${{ github.event.pull_request.head.ref }}
SHA: ${{ github.event.pull_request.head.sha }}
run: |
echo "Commit Short SHA: ${{ steps.short-sha.outputs.sha }}"
echo "Commit SHA: ${{ github.event.pull_request.head.sha }}"
echo "Branch: ${{ github.event.pull_request.head.ref }}"
echo "Commit SHA: ${{ env.SHA }}"
echo "Branch: ${{ env.BRANCH }}"
- name: Setup Node ⚙️
uses: ./.github/actions/setup-node
with:
Expand All @@ -29,12 +32,16 @@ jobs:
run: npm run build && find dist/index.js
- name: Normalize npm tag
id: npm
env:
BRANCH: ${{ github.event.pull_request.head.ref }}
run: |
npm_tag=$(echo ${{ github.event.pull_request.head.ref }} | sed 's/\//-/g')
npm_tag=$(echo ${{ env.BRANCH }} | sed 's/\//-/g')
echo "NPM Tag: $npm_tag"
echo "tag=$npm_tag" >> "$GITHUB_OUTPUT"
- name: Update library version
run: npm version --allow-same-version --no-git-tag-version prerelease --preid=rc.${{ github.event.pull_request.head.sha }}
env:
SHA: ${{ github.event.pull_request.head.sha }}
run: npm version --allow-same-version --no-git-tag-version prerelease --preid=rc.${{ env.SHA }}
- name: get-npm-version
id: package-version
uses: martinbeentjes/[email protected]
Expand All @@ -48,14 +55,17 @@ jobs:
utc=$(date -u +"%b %-d, %Y at %-I:%M%p (UTC)")
echo "utc=$utc" >> "$GITHUB_OUTPUT"
- uses: marocchino/sticky-pull-request-comment@v2
env:
BRANCH: ${{ github.event.pull_request.head.ref }}
SHA: ${{ github.event.pull_request.head.sha }}
with:
header: <release-candidate>
message: |
## ☁️ Release Candidate Preview
📘 Name | 🔑 Latest Commit | 📦 NPM | 🕒 Updated
--- | --- | ---| ---
[typescript-library-template-example](https://github.com/AlbertHernandez/typescript-library-template/tree/${{ github.event.pull_request.head.ref }}) | [${{ steps.short-sha.outputs.sha }}](https://github.com/AlbertHernandez/typescript-library-template/commit/${{ github.event.pull_request.head.sha }}) | [NPM](https://www.npmjs.com/package/typescript-library-template-example/v/${{ steps.npm.outputs.tag }}) | ${{ steps.date.outputs.utc }}
[typescript-library-template-example](https://github.com/AlbertHernandez/typescript-library-template/tree/${{ env.BRANCH }}) | [${{ steps.short-sha.outputs.sha }}](https://github.com/AlbertHernandez/typescript-library-template/commit/${{ env.SHA }}) | [NPM](https://www.npmjs.com/package/typescript-library-template-example/v/${{ steps.npm.outputs.tag }}) | ${{ steps.date.outputs.utc }}
### 💻 Client installation
Expand Down

0 comments on commit 0c98696

Please sign in to comment.