Skip to content

Commit

Permalink
Merge branch 'support_release'
Browse files Browse the repository at this point in the history
  • Loading branch information
masamitsu-murase committed Aug 14, 2021
2 parents 72b7432 + c103519 commit efca695
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,65 @@ jobs:

- name: Run tests
run: python -m unittest discover -s tests

release:
if: startsWith(github.ref, 'refs/tags/')

needs: [test]
runs-on: ubuntu-latest

steps:
- name: "Disable git autoCRLF"
run: git config --global core.autoCRLF false

- uses: actions/checkout@v2

- uses: actions/setup-python@v2

- name: Install dependencies
run: pip install wheel

- name: Create wheel package
run: python setup.py bdist_wheel

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: Release ${{ github.ref }}
draft: true
prerelease: false

- run: ls -alF dist

- name: Upload all artifacts
uses: actions/github-script@v3
with:
release_id: ${{ steps.create_release.outputs.id }}
assets_dir: dist
script: |
console.log("environment", process.versions);
const fs = require("fs").promises;
const path = require("path");
const { repo: { owner, repo } } = context;
const release_id = core.getInput("release_id", { required: true });
const assets_dir = core.getInput("assets_dir", { required: true });
const files = await fs.readdir(assets_dir);
console.log("files", files);
const asset_uploaders = files.map(file => path.join(assets_dir, file)).map(file => {
return fs.readFile(file).then(data => {
return github.repos.uploadReleaseAsset({
owner,
repo,
release_id,
name: path.basename(file),
data
});
});
})
Promise.all(asset_uploaders);

0 comments on commit efca695

Please sign in to comment.