diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..509d6de --- /dev/null +++ b/.github/workflows/build.yml @@ -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 + diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..3ea360e --- /dev/null +++ b/.github/workflows/nightly.yml @@ -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 diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..6683e45 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..84dfc8a --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }}* +