From c09db19c38301677a0b56fe83b211d9378c7da32 Mon Sep 17 00:00:00 2001 From: Kray-G Date: Fri, 27 Aug 2021 17:33:10 +0900 Subject: [PATCH] #232: updated kip. --- lib/exec/etc/kipmain.yml | 78 ++++++++++++++++++++++++++++++++++++++++ lib/exec/kip.kx | 13 +++---- 2 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 lib/exec/etc/kipmain.yml diff --git a/lib/exec/etc/kipmain.yml b/lib/exec/etc/kipmain.yml new file mode 100644 index 00000000..c5b02131 --- /dev/null +++ b/lib/exec/etc/kipmain.yml @@ -0,0 +1,78 @@ +name: CI + +on: + push: + tags: ['v*'] + +jobs: + package: + name: package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: package + run: | + ref='${{ github.ref }}' + tag=$(echo $ref | perl -e "print pop @{[split '/', <>]}") + + mkdir -p $tag/docs + cp -r ./src/* $tag/ + cp -r ./docs/* $tag/docs/ + cd $tag + zip -r ../package.zip * + - name: upload archive + uses: actions/upload-artifact@v1 + with: + name: package + path: package.zip + + release: + name: release + runs-on: ubuntu-latest + outputs: + release_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - name: create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: true + + upload-assets: + name: upload assets + needs: + - release + - package + runs-on: ubuntu-latest + strategy: + matrix: + job: [package] + include: + - job: package + jobname: package + download_name: package + asset_path: package.zip + asset_name: package.zip + content_type: application/zip + steps: + - name: download archive + id: download_archive + uses: actions/download-artifact@v1 + with: + name: ${{ matrix.download_name }} + path: ./ + - name: display structure of downloaded files + run: ls -R + - name: upload asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.release_url }} + asset_path: ${{ matrix.asset_path }} + asset_name: ${{ matrix.asset_name }} + asset_content_type: ${{ matrix.content_type }} diff --git a/lib/exec/kip.kx b/lib/exec/kip.kx index 210a01cd..56dc8e4e 100644 --- a/lib/exec/kip.kx +++ b/lib/exec/kip.kx @@ -1,8 +1,3 @@ -/* - Currently under development. - Do not use this. -*/ - using SemanticVersion; using DateTime; using MarkdownConsole; @@ -728,7 +723,12 @@ class KinxPackageLibraryManager(repoMgr_) { } private mkdir(dir, deffile, text, desc) { - File.mkdir(dir); + if (!File.exists(dir)) { + File.mkdir(dir); + } + if (!File.isDirectory(dir)) { + throw RuntimeException("Not a directory: %{dir}"); + } Kip.progressln("Created the directory of '%{dir}'."); if (deffile.isString) { deffile = dir / deffile; @@ -771,6 +771,7 @@ class KinxPackageLibraryManager(repoMgr_) { mkdir("src/etc", "%{name}.json", '{}', "an initial setting file"); + mkdir(".github/workflows", "main.yml", File.load(__FILE__.parentPath() / "etc/kipmain.yml"), "a default CI file"); return true; }