Skip to content

Commit

Permalink
Fix Github Action Workflow (#7) (#8)
Browse files Browse the repository at this point in the history
* Fix Github Action Workflow

* Debug Publish Script

* verify Build

* Fix Build

* Use Updated Versions
  • Loading branch information
TosinJs authored Mar 13, 2024
1 parent 8bda7e3 commit fe70337
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 16 deletions.
53 changes: 41 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,64 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: 20

- name: Read version from package.json
id: package_version
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
run: echo "RELEASE_TAG=$(node -p "require('./package.json').version")" >> $GITHUB_ENV

- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: "actions/github-script@v7"
with:
tag_name: v${{ env.PACKAGE_VERSION }}
release_name: Release v${{ env.PACKAGE_VERSION }}
draft: false
prerelease: false
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
try {
const response = await github.rest.repos.createRelease({
draft: false,
generate_release_notes: true,
name: process.env.RELEASE_TAG,
owner: context.repo.owner,
prerelease: false,
repo: context.repo.repo,
tag_name: process.env.RELEASE_TAG,
});
core.exportVariable('RELEASE_ID', response.data.id);
core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url);
} catch (error) {
core.setFailed(error.message);
}
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- run: |
if [ -z "${NODE_AUTH_TOKEN}" ]; then
echo "NODE_AUTH_TOKEN is not set."
exit 1
else
echo "NODE_AUTH_TOKEN is set."
fi
if [ -z "${WATSON_URL}" ]; then
echo "WATSON_URL is not set."
exit 1
else
echo "WATSON_URL is set."
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
WATSON_URL: ${{ secrets.WATSON_URL }}
- run: npm ci
- run: npm run build
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/gandalf-network/eyeofsauron.git"
"url": "git+https://github.com/gandalf-network/eyeofsauron.git"
},
"dependencies": {
"@graphql-codegen/cli": "^5.0.2",
Expand All @@ -37,5 +37,5 @@
"dotenv": "^16.4.5",
"jest": "^29.7.0",
"ts-jest": "^29.1.2"
}
}
}

0 comments on commit fe70337

Please sign in to comment.