Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbalogh committed Mar 1, 2021
1 parent b81c2ec commit 93f7411
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,34 @@ jobs:
- name: Get git tag
run: echo "HEAD_TAG=$(git tag --points-at HEAD)" >> $GITHUB_ENV

- name: Create release if git tag
id: create_release
- name: Create Release
if: env.HEAD_TAG != ''
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/github-script@v2
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
console.log('environment', process.versions);
const fs = require('fs').promises;
const { repo: { owner, repo }, sha } = context;
console.log({ owner, repo, sha });
- name: Upload asset
if: env.HEAD_TAG != ''
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/openapi.yaml
asset_name: openapi.yaml
asset_content_type: application/x-yaml
const release = await github.repos.createRelease({
owner, repo,
tag_name: process.env.GITHUB_REF,
draft: true,
target_commitish: sha
});
console.log('created release', { release });
let upload_files = [
'openapi.yaml',
'openapi.json'
]
for (let file of upload_files) {
await github.repos.uploadReleaseAsset({
owner, repo,
release_id: release.data.id,
name: file,
data: await fs.readFile(`./artifacts/${file}`)
});
}

0 comments on commit 93f7411

Please sign in to comment.