ci: add more workflows

This commit is contained in:
Daylin Morgan 2023-12-05 16:34:12 -06:00
parent ed2c456b0d
commit f1077adc9f
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
4 changed files with 162 additions and 0 deletions

58
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,58 @@
name: ⚙️ Build Binaries
on:
workflow_call:
workflow_dispatch:
env:
APP_NAME: yartsu
RELEASE_FILES: README.md
jobs:
build-artifact:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macOS-latest
# - windows-latest # broken
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Pyoxidizer
run: pip install pyoxidizer
- name: Build Binary
run: pyoxidizer build --release
- name: Create Artifact
shell: bash
run: |
assets="${{ env.APP_NAME }}_$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]')"
echo "$assets"
mkdir -p "dist/$assets"
cp -r build/**/release/install/${{ env.APP_NAME }}/* "dist/$assets/"
cp -r ${{ env.RELEASE_FILES }} "dist/$assets/"
(
cd dist
if [[ "${{ runner.os }}" == Windows ]]; then
7z a "$assets.zip" "$assets"
else
tar czf "$assets.tar.gz" "$assets"
fi
ls -lah *.*
)
- uses: actions/upload-artifact@v3
with:
name: artifact-${{ matrix.os }}
path: |
dist/*.tar.gz
dist/*.zip

24
.github/workflows/nightly.yml vendored Normal file
View file

@ -0,0 +1,24 @@
name: 🌙 Nightly Release
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
permissions:
contents: write
jobs:
check-commits:
uses: daylinmorgan/actions/.github/workflows/check-commits.yml@main
with:
since: "24 hours"
build-artifacts:
needs: check-commits
if: ${{ needs.check-commits.outputs.quit != 'true' }}
uses: .github/workflows/build.yml
generate-release:
needs: build-artifacts
uses: daylinmorgan/actions/.github/workflows/nightly.yml@main

40
.github/workflows/pypi.yml vendored Normal file
View file

@ -0,0 +1,40 @@
name: Build and Publish to PyPI
on:
workflow_call:
workflow_dispatch:
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

40
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,40 @@
name: 🚀 Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
env:
app-name: yartsu
jobs:
build-artifacts:
uses: ./.github/workflows/build.yml
pypi-release:
uses: ./.github/workflows/pypi.yml
create-release:
env:
GH_TOKEN: ${{ github.token }}
runs-on: ubuntu-latest
needs:
- build-artifacts
steps:
- uses: actions/checkout@v3
- name: Download Build Artifacts
uses: actions/download-artifact@v3
with:
path: dist/
- run: ls -R dist/
- name: Generate New Nightly Release
run: |
gh release create ${{ github.ref }} ./dist/*/${{ env.app-name }}*