mirror of
https://github.com/iBug/pac.git
synced 2025-07-13 12:52:15 +08:00
Use modern GitHub Actions
This commit is contained in:
parent
c9672b8135
commit
1223f04dc9
18
.github/workflows/build.yml
vendored
18
.github/workflows/build.yml
vendored
@ -7,27 +7,23 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: "0 12 * * 6" # 8 PM CST every Saturday
|
- cron: "0 12 * * 6" # 8 PM CST every Saturday
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v3
|
||||||
- run: |
|
- run: |
|
||||||
python3 build.py
|
python3 build.py
|
||||||
gzip -9 dist/*.txt
|
gzip -9 dist/*.txt
|
||||||
- name: Generate release info
|
- name: Generate release info
|
||||||
id: release-info
|
id: release-info
|
||||||
run: python3 release-info.py
|
run: python3 release-info.py
|
||||||
- uses: actions/create-release@v1
|
- uses: softprops/action-gh-release@v1
|
||||||
id: create_release
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
with:
|
||||||
|
name: ${{ steps.release-info.outputs.release_name }}
|
||||||
tag_name: ${{ steps.release-info.outputs.tag_name }}
|
tag_name: ${{ steps.release-info.outputs.tag_name }}
|
||||||
release_name: ${{ steps.release-info.outputs.release_name }}
|
|
||||||
body_path: ${{ steps.release-info.outputs.body_path }}
|
body_path: ${{ steps.release-info.outputs.body_path }}
|
||||||
- uses: csexton/release-asset-action@v2
|
files: 'dist/*'
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
pattern: 'dist/*'
|
|
||||||
release-url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
|
@ -6,16 +6,19 @@ import os
|
|||||||
|
|
||||||
|
|
||||||
RELEASE_MARKDOWN_PATH = "release-info.md"
|
RELEASE_MARKDOWN_PATH = "release-info.md"
|
||||||
|
OUTPUT_TARGET = None
|
||||||
|
|
||||||
|
|
||||||
def create_output(name, content, target=sys.stdout):
|
def create_output(name, content):
|
||||||
print(f"::set-output name={name}::{content}", file=target)
|
print(f"{name}={content}", file=OUTPUT_TARGET)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
global OUTPUT_TARGET
|
||||||
if "GITHUB_ACTIONS" not in os.environ:
|
if "GITHUB_ACTIONS" not in os.environ:
|
||||||
print("GitHub Actions environment expected but not found, abort.", file=sys.stderr)
|
print("GitHub Actions environment expected but not found, abort.", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
OUTPUT_TARGET = open(os.environ["GITHUB_OUTPUT"], "a")
|
||||||
|
|
||||||
# Credits: https://stackoverflow.com/a/1398742/5958455
|
# Credits: https://stackoverflow.com/a/1398742/5958455
|
||||||
# Depends on os.environ["TZ"]
|
# Depends on os.environ["TZ"]
|
||||||
|
Loading…
Reference in New Issue
Block a user