Skip to content

Release

Release #19

Workflow file for this run

name: Release
on:
release:
types: [published]
branches:
- '*'
jobs:
build_and_test_workflow:
runs-on: ubuntu-latest
outputs:
workflow_status: ${{ steps.workflow_status.outputs.status }}
steps:
- name: Wait for Build and Test
id: workflow_status
uses: actions/github-script@v4
with:
script: |
const { data: runs } = await github.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_file: 'pipeline.yml',
status: 'success',
})
if (runs.total_count > 0) {
return 'success';
} else {
return 'failure';
}
release_windows:
needs: build_and_test_workflow
if: needs.build_and_test_workflow.outputs.workflow_status == 'success'
permissions: write-all
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
- name: Build Installer
run: |
pyinstaller --onefile --windowed --name M3U8Downloader.${{ github.event.release.tag_name }}-Windows.exe ./src/__init__.py
- name: Upload Installer
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./dist/M3U8Downloader.${{ github.event.release.tag_name }}-Windows.exe
asset_name: M3U8Downloader.${{ github.event.release.tag_name }}-Windows.exe
asset_content_type: application/octet-stream
- name: Publish Release
if: ${{ steps.upload-release-asset.outcome == 'success' }}
run: |
$json = @{
draft = $false
} | ConvertTo-Json
$header = @{
Authorization = "Bearer ${{ secrets.GITHUB_TOKEN }}"
Accept = "application/vnd.github.v3+json"
}
Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}" -Method Patch -ContentType "application/json" -Headers $header -Body $json
release_ubuntu:
needs: build_and_test_workflow
if: needs.build_and_test_workflow.outputs.workflow_status == 'success'
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
- name: Build Installer
run: |
pyinstaller --onefile --windowed --name M3U8Downloader.${{ github.event.release.tag_name }}-debian.deb ./src/__init__.py
- name: Upload Installer
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./dist/M3U8Downloader.${{ github.event.release.tag_name }}-debian.deb
asset_name: M3U8Downloader.${{ github.event.release.tag_name }}-debian.deb
asset_content_type: application/octet-stream
- name: Publish Release
if: ${{ steps.upload-release-asset.outcome == 'success' }}
run: |
curl -X PATCH \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{"draft": false}' \
"https://api.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}"
release_rhel:
needs: build_and_test_workflow
if: needs.build_and_test_workflow.outputs.workflow_status == 'success'
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
- name: Build Installer
run: |
pyinstaller --onefile --windowed --name M3U8Downloader.${{ github.event.release.tag_name }}-linux.rpm ./src/__init__.py
- name: Upload Installer
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./dist/M3U8Downloader.${{ github.event.release.tag_name }}-linux.rpm
asset_name: M3U8Downloader.${{ github.event.release.tag_name }}-linux.rpm
asset_content_type: application/octet-stream
- name: Publish Release
if: ${{ steps.upload-release-asset.outcome == 'success' }}
run: |
curl -X PATCH \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{"draft": false}' \
"https://api.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}"