mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
fix paths with subdirs
This commit is contained in:
29
.github/workflows/push.yml
vendored
29
.github/workflows/push.yml
vendored
@@ -1,29 +0,0 @@
|
|||||||
name: 'tip'
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
- '!tip'
|
|
||||||
branches:
|
|
||||||
- '*'
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
env:
|
|
||||||
CI: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
tip:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
echo "Build some tool and generate some artifacts" > artifact.txt
|
|
||||||
- uses: ./
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
files: |
|
|
||||||
artifact.txt
|
|
||||||
README.md
|
|
||||||
56
.github/workflows/test.yml
vendored
Normal file
56
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
name: 'test'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
- '!tip'
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
CI: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- run: echo "Build some tool and generate some artifacts" > artifact.txt
|
||||||
|
|
||||||
|
- name: Single
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
files: artifact.txt
|
||||||
|
|
||||||
|
- name: List
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
files: |
|
||||||
|
artifact.txt
|
||||||
|
README.md
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
mkdir artifacts
|
||||||
|
echo "Build some tool and generate some artifacts" > artifacts/artifact.txt
|
||||||
|
|
||||||
|
- name: Single in subdir
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
files: artifacts/artifact.txt
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
echo "tip hello" > artifacts/hello.md
|
||||||
|
echo "tip world" > artifacts/world.md
|
||||||
|
|
||||||
|
- name: Directory wildcard
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
files: artifacts/*
|
||||||
20
tip.py
20
tip.py
@@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
from os import environ, getenv
|
from os import environ, getenv
|
||||||
from sys import argv, stdout
|
from sys import argv, stdout
|
||||||
from github import Github
|
|
||||||
from subprocess import check_call
|
from subprocess import check_call
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
from pathlib import Path
|
||||||
|
from github import Github
|
||||||
|
|
||||||
print("· Get list of artifacts to be uploaded")
|
print("· Get list of artifacts to be uploaded")
|
||||||
|
|
||||||
@@ -70,18 +71,19 @@ artifacts = files
|
|||||||
for asset in gh_release.get_assets():
|
for asset in gh_release.get_assets():
|
||||||
print(">", asset)
|
print(">", asset)
|
||||||
print(" ", asset.name)
|
print(" ", asset.name)
|
||||||
for fname in artifacts:
|
for artifact in artifacts:
|
||||||
if asset.name == fname:
|
aname = str(Path(artifact).name)
|
||||||
|
if asset.name == aname:
|
||||||
print(" removing '%s'..." % asset.name)
|
print(" removing '%s'..." % asset.name)
|
||||||
asset.delete_asset()
|
asset.delete_asset()
|
||||||
print(" uploading '%s'..." % fname)
|
print(" uploading '%s'..." % artifact)
|
||||||
gh_release.upload_asset(fname)
|
gh_release.upload_asset(artifact, name=aname)
|
||||||
artifacts.remove(fname)
|
artifacts.remove(artifact)
|
||||||
break
|
break
|
||||||
|
|
||||||
for fname in artifacts:
|
for artifact in artifacts:
|
||||||
print(" uploading '%s'..." % fname)
|
print(" uploading '%s'..." % artifact)
|
||||||
gh_release.upload_asset(fname)
|
gh_release.upload_asset(artifact)
|
||||||
|
|
||||||
stdout.flush()
|
stdout.flush()
|
||||||
print("· Update Release reference (force-push tag)")
|
print("· Update Release reference (force-push tag)")
|
||||||
|
|||||||
Reference in New Issue
Block a user