Skip to content

Commit

Permalink
Update deploy workflow Together I've defeated for the first time that…
Browse files Browse the repository at this point in the history
… I'm vivid
  • Loading branch information
StefanH-AT committed Dec 29, 2022
1 parent a429104 commit 15c1c0b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
49 changes: 23 additions & 26 deletions .github/workflows/_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,33 @@ jobs:
working-directory: ./packages/${{ inputs.package-name }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- run: |
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'

- name: Summary Head
run: |
echo "# Deployment Summary" >> $GITHUB_STEP_SUMMARY
echo "Date: $(date) " >> $GITHUB_STEP_SUMMARY
echo "Run ID: ${{ github.run_id }} " >> $GITHUB_STEP_SUMMARY
echo "Run Number: ${{ github.run_number }} " >> $GITHUB_STEP_SUMMARY
echo "Run Attempt: ${{ github.run_attempt }} " >> $GITHUB_STEP_SUMMARY
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'

- run: |
echo "Node Version: $(node --version) - NPM Version: $(npm --version) " >> $GITHUB_STEP_SUMMARY
echo "---" >> $GITHUB_STEP_SUMMARY
echo "Package Name: **${{ inputs.package-name }}** " >> $GITHUB_STEP_SUMMARY
- name: Read package.json
id: package-json
run: |
echo "PACKAGE_JSON<<GH-EOF" >> $GITHUB_ENV
cat ./package.json >> $GITHUB_ENV
echo "GH-EOF" >> $GITHUB_ENV
- run: |
- name: "Read package version"
run: |
version=${{ fromJson(env.PACKAGE_JSON).version }}
escaped_version=$(printf '%s\n' "$version" | sed -e 's/[]\/$*.^[]/\\&/g')
echo "VERSION=$version" >> $GITHUB_ENV
Expand All @@ -61,14 +61,12 @@ jobs:
run: npm run test

- name: Publish
run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: |
run: |
npm publish --access=public
echo "" >> $GITHUB_STEP_SUMMARY
echo "Successfully published to the [NPM registry](https://www.npmjs.com/package/@sourcelib/${{inputs.package-name}}/v/$VERSION)" >> $GITHUB_STEP_SUMMARY
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Get Changelog
id: changelog
Expand All @@ -84,27 +82,25 @@ jobs:
changelog2="${changelog2//$'`'/'\`'}"
changelog2="${changelog2//$'"'/'\"'}"
changelog2="${changelog2//"'"/"'\''"}"
echo "escaped=$changelog" >> $GITHUB_OUTPUT
echo "unescaped=$changelog1" >> $GITHUB_OUTPUT
echo "doubleescaped=$changelog2" >> $GITHUB_OUTPUT
echo "---" >> $GITHUB_STEP_SUMMARY
echo $escaped >> $GITHUB_STEP_SUMMARY
echo "CL_ESCAPED=$changelog" >> $GITHUB_ENV
echo "CL_UNESCAPED=$changelog1" >> $GITHUB_ENV
echo "CL_DOUBLEESCAPED=$changelog2" >> $GITHUB_ENV
- name: Github Release
id: release
uses: softprops/action-gh-release@v1
with:
body: "${{steps.changelog.outputs.unescaped}}"
body: "${{env.CL_UNESCAPED}}"
tag_name: "${{inputs.package-name}}-${{env.VERSION}}"

- name: Prepare Discord Message
id: discord-msg
working-directory: ./
run: |
awk '{
gsub("#VERSION#","$VERSION",$0);
gsub("#VERSION#","${{env.VERSION}}",$0);
gsub("#PACKAGE#","${{inputs.package-name}}",$0);
gsub("#DESCRIPTION#","${{steps.changelog.outputs.doubleescaped}}",$0);
gsub("#DESCRIPTION#","${{env.CL_DOUBLEESCAPED}}",$0);
print $0;
}' ./.github/workflows/deploy_discord_message.json > ./.github/workflows/deploy_discord_message2.json
Expand All @@ -115,5 +111,6 @@ jobs:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
raw-data: "./.github/workflows/deploy_discord_message2.json"

- run: |
- name: Summary Footer
run: |
echo "Discord Message sent successfully" >> $GITHUB_STEP_SUMMARY
4 changes: 4 additions & 0 deletions packages/kv/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

The versions in this file adhere to [semantic versioning](https://semver.org/).

## [0.3.3]

- This is a test release

## [0.3.2]

- This is a test release
Expand Down
2 changes: 1 addition & 1 deletion packages/kv/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sourcelib/kv",
"version": "0.3.2",
"version": "0.3.3",
"description": "Source Engine KeyValue file parser and tokenizer library",
"main": "lib/main.js",
"scripts": {
Expand Down

0 comments on commit 15c1c0b

Please sign in to comment.