Skip to content

Commit

Permalink
ci: add more workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
daylinmorgan committed Dec 5, 2023
1 parent ed2c456 commit f1077ad
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 24 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 40 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}*

0 comments on commit f1077ad

Please sign in to comment.