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