mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
add option 'rm' (#156)
This commit is contained in:
7
.github/workflows/test.yml
vendored
7
.github/workflows/test.yml
vendored
@@ -19,20 +19,21 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- run: echo "Build some tool and generate some artifacts" > artifact.txt
|
- run: echo "Build some tool and generate some (versioned) artifacts" > artifact-$(date -u +"%Y-%m-%dT%H-%M-%SZ").txt
|
||||||
|
|
||||||
- name: Single
|
- name: Single
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
rm: true
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
files: artifact.txt
|
files: artifact-*.txt
|
||||||
|
|
||||||
- name: List
|
- name: List
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
files: |
|
files: |
|
||||||
artifact.txt
|
artifact-*.txt
|
||||||
README.md
|
README.md
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
|
|||||||
@@ -36,3 +36,5 @@ jobs:
|
|||||||
Note that the tag and the pre-release need to be created manually the first time. The workflow above will fail if the release does not exist.
|
Note that the tag and the pre-release need to be created manually the first time. The workflow above will fail if the release does not exist.
|
||||||
|
|
||||||
The default tag name is `tip`, but it can be optionally overriden through option `tag` or setting envvar `INPUT_TAG`.
|
The default tag name is `tip`, but it can be optionally overriden through option `tag` or setting envvar `INPUT_TAG`.
|
||||||
|
|
||||||
|
If you systematically want to remove previous artifacts (e.g. old versions), set the `rm` option to true.
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ inputs:
|
|||||||
description: 'Name of the tag that corresponds to the tip/nightly pre-release'
|
description: 'Name of the tag that corresponds to the tip/nightly pre-release'
|
||||||
required: false
|
required: false
|
||||||
default: tip
|
default: tip
|
||||||
|
rm:
|
||||||
|
description: 'Whether to delete all the previous artifacts, or only replacing the ones with the same name'
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: 'Dockerfile'
|
image: 'Dockerfile'
|
||||||
|
|||||||
6
tip.py
6
tip.py
@@ -68,6 +68,12 @@ print("· Upload artifacts")
|
|||||||
|
|
||||||
artifacts = files
|
artifacts = files
|
||||||
|
|
||||||
|
if getenv('INPUT_RM', 'false') == 'true':
|
||||||
|
print("· RM set. All previous assets are being cleared...")
|
||||||
|
for asset in gh_release.get_assets():
|
||||||
|
print(" ", asset.name)
|
||||||
|
asset.delete_asset()
|
||||||
|
else:
|
||||||
for asset in gh_release.get_assets():
|
for asset in gh_release.get_assets():
|
||||||
print(">", asset)
|
print(">", asset)
|
||||||
print(" ", asset.name)
|
print(" ", asset.name)
|
||||||
|
|||||||
Reference in New Issue
Block a user