Vita3K-bin/.github/workflows/fetch-release.yml

61 lines
2 KiB
YAML
Raw Normal View History

2025-01-10 00:37:11 +00:00
name: Fetch and Publish Latest Release
on:
schedule:
- cron: '0 18 * * *' # 3:00 AM GMT+9
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for the manual release'
required: true
default: 'YYYYMMDD-manual-HHMMSS'
2025-01-10 00:40:13 +00:00
push:
branches:
2025-01-10 00:40:40 +00:00
- main
2025-01-10 00:37:11 +00:00
jobs:
fetch-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout this repository
uses: actions/checkout@v2
- name: Fetch latest release from Vita3K
id: fetch_release
run: |
latest_release=$(curl -s https://api.github.com/repos/Vita3K/Vita3K/releases/latest)
2025-01-10 00:48:15 +00:00
echo "tag_name=$(echo $latest_release | jq -r .tag_name)" >> $GITHUB_ENV
echo "release_body=$(echo $latest_release | jq -r .body)" >> $GITHUB_ENV
echo "assets=$(echo $latest_release | jq -r '.assets[] | .browser_download_url')" >> $GITHUB_ENV
2025-01-10 00:37:53 +00:00
release_name=$(echo $latest_release | jq -r .body | grep -oP 'Vita3K Build: \d+')
2025-01-10 00:48:15 +00:00
echo "release_name=$release_name" >> $GITHUB_ENV
2025-01-10 00:37:11 +00:00
- name: Download assets
run: |
mkdir -p artifacts
2025-01-10 00:48:15 +00:00
for url in ${{ env.assets }}; do
2025-01-10 00:37:11 +00:00
wget -P artifacts $url
done
- name: Create release in this repository
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
2025-01-10 00:48:15 +00:00
tag_name: ${{ env.tag_name || format('YYYYMMDD-HHmmss', github.event.inputs['time']) }}
release_name: ${{ env.release_name }}
body: ${{ env.release_body }}
2025-01-10 00:37:11 +00:00
draft: false
prerelease: false
- name: Upload assets to the new release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
2025-01-10 00:45:35 +00:00
asset_path: artifacts/$(basename $asset_path)
2025-01-10 00:37:11 +00:00
asset_name: $(basename $asset_path)
asset_content_type: application/octet-stream