diff --git a/.github/workflows/Production.yml b/.github/workflows/Production.yml index c7ce8cb..8260271 100644 --- a/.github/workflows/Production.yml +++ b/.github/workflows/Production.yml @@ -33,10 +33,12 @@ jobs: uses: JS-DevTools/npm-publish@v1 with: token: ${{ secrets.NPM_TOKEN }} - - name: Get release version - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' - run: echo ::set-env name=DATHOST_VERSION::$(npm info dathost version) + - name: Get Version + id: version + uses: notiz-dev/github-action-json-property@release + with: + path: 'package.json' + prop_path: 'version' - name: Delete npmrc run: rm -f ./.npmrc - name: Build with esbuild @@ -45,9 +47,9 @@ jobs: uses: marvinpinto/action-automatic-releases@v1.2.0 with: repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "${{ env.DATHOST_VERSION }}" + automatic_release_tag: "${{steps.version.outputs.prop}}" prerelease: false - title: "${{ env.DATHOST_VERSION }}" + title: "${{steps.version.outputs.prop}}" files: dist/** - name: Build docs run: npm run docs diff --git a/package.json b/package.json index f7df8b1..ff3a8f7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dathost", - "version": "0.0.7", + "version": "0.0.8", "description": "TypeScript wrapper for Dathost's API", "main": "src/index.ts", "files": [ diff --git a/src/http.ts b/src/http.ts index acaac99..2c7579f 100644 --- a/src/http.ts +++ b/src/http.ts @@ -28,7 +28,10 @@ export default class HTTP { ) } - public async get(url: string): Promise { + public async get(url: string, raw = false): Promise { + if (raw) { + return await this.request.get(url, { responseType: 'blob' }) + } return await this.request.get(url) } diff --git a/src/server/file.ts b/src/server/file.ts index f25c30c..2490f4a 100644 --- a/src/server/file.ts +++ b/src/server/file.ts @@ -36,8 +36,8 @@ export default class File { await this.http.put(this.url, payload) } - public async download(asText = false): Promise { - return await this.http.get(`${this.url}?as_text=${asText.toString()}`) + public async download(asText = false): Promise { + return await this.http.get(`${this.url}?as_text=${asText.toString()}`, !asText) } public async upload(data: Blob): Promise {