Merge pull request #6 from julianvilas/vendor-pyBusPirateLite-564d047 #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Create Release | |
permissions: | |
contents: write | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build package | |
run: python -m build | |
- name: Create Release and Upload Assets | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const fs = require('fs'); | |
const path = require('path'); | |
const tag = process.env.GITHUB_REF; | |
const repo = process.env.GITHUB_REPOSITORY; | |
const [owner, repoName] = repo.split('/'); | |
const releaseResponse = await github.rest.repos.createRelease({ | |
owner: owner, | |
repo: repoName, | |
tag_name: tag, | |
name: `Release ${tag.replace('refs/tags/', '')}`, | |
}); | |
const { id: id } = releaseResponse.data; | |
globber = await glob.create('dist/*'); | |
const files = await globber.glob(); | |
for (const file of files) { | |
const content = fs.readFileSync(file); | |
const name = path.basename(file); | |
await github.rest.repos.uploadReleaseAsset({ | |
name: name, | |
owner: owner, | |
repo: repoName, | |
release_id: id, | |
data: content, | |
}); | |
} |