cache init, no make or git

This commit is contained in:
Jesse Bannon 2023-02-22 15:06:05 -08:00
parent 5bd347a44b
commit 3681307f8e

View file

@ -6,7 +6,7 @@ on:
- master - master
pull_request: pull_request:
jobs: jobs:
get-version: set-version:
name: github-release name: github-release
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -40,15 +40,30 @@ jobs:
echo "${{ env.PYPI_VERSION }}" echo "${{ env.PYPI_VERSION }}"
echo "${{ env.LOCAL_VERSION }}" echo "${{ env.LOCAL_VERSION }}"
- name: Write to init file
run: |
echo "__pypi_version__ = \"${{ env.PYPI_VERSION }}\"\n__local_version__ = \"${{ env.LOCAL_VERSION }}\"" > src/ytdl_sub/__init__.py
- name: Save modified init
uses: actions/cache@v3
with:
path: src/ytdl_sub/__init__.py
key: ${{ env.PYPI_VERSION }}
################################################################################################## ##################################################################################################
build-unix: build-unix:
name: build-unix name: build-unix
needs: needs:
- get-version - set-version
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Restore modified init
uses: actions/cache@v3
with:
path: src/ytdl_sub/__init__.py
key: ${{ env.PYPI_VERSION }}
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4
with: with:
python-version: '3.10' python-version: '3.10'
@ -73,6 +88,11 @@ jobs:
arch: [ "aarch64" ] arch: [ "aarch64" ]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Restore modified init
uses: actions/cache@v3
with:
path: src/ytdl_sub/__init__.py
key: ${{ env.PYPI_VERSION }}
- uses: uraimo/run-on-arch-action@v2 - uses: uraimo/run-on-arch-action@v2
name: Run commands name: Run commands
id: runcmd id: runcmd
@ -86,12 +106,12 @@ jobs:
# Set an output parameter `uname` for use in subsequent steps # Set an output parameter `uname` for use in subsequent steps
run: | run: |
apk add python3 py3-pip make git apk add python3 py3-pip
python3 -m pip install -e . python3 -m pip install -e .
echo "Done!" echo "Done!"
python3 -m pip install pyinstaller python3 -m pip install pyinstaller
EXEC_SUFFIX=_${{ matrix.arch }} make executable pyinstaller ytdl-sub.spec
mv dist/ytdl-sub_${{ matrix.arch }} /artifacts mv dist/ytdl-sub /artifacts/ytdl-sub_${{ matrix.arch }}
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
@ -108,6 +128,11 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Restore modified init
uses: actions/cache@v3
with:
path: src/ytdl_sub/__init__.py
key: ${{ env.PYPI_VERSION }}
- name: Create Release - name: Create Release
if: ${{ github.ref == 'refs/heads/master' }} if: ${{ github.ref == 'refs/heads/master' }}
@ -135,7 +160,11 @@ jobs:
with: with:
fetch-depth: 0 # Needed for correct commit count. TODO: define once using GH actions fetch-depth: 0 # Needed for correct commit count. TODO: define once using GH actions
ref: master ref: master
- name: Restore modified init
uses: actions/cache@v3
with:
path: src/ytdl_sub/__init__.py
key: ${{ env.PYPI_VERSION }}
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3 uses: actions/setup-python@v3
with: with: