New Release #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: New Release | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Tag" | |
required: true | |
default: "v1.x.x" | |
latest: | |
description: "Set as latest" | |
required: true | |
default: "true" | |
type: choice | |
options: | |
- true | |
- false | |
is_draft: | |
description: "Set as draft" | |
required: true | |
type: choice | |
default: "true" | |
options: | |
- true | |
- false | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, windows-2019] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Clone client | |
uses: actions/checkout@v2 | |
- name: Setup Node 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: Install yarn | |
run: | | |
npm install -g yarn | |
- name: Clone client | |
run: | | |
git clone https://github.com/swing-opensource/swingmusic-client.git | |
- name: Install dependencies & Build client | |
run: | | |
cd swingmusic-client | |
yarn install | |
yarn build --outDir ../client | |
cd .. | |
- name: Install Python 3.10.11 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10.11" | |
- name: Install Poetry | |
run: | | |
pip install poetry | |
- name: Install dependencies | |
run: | | |
python -m poetry install | |
- name: Build server | |
run: | | |
python -m poetry run python manage.py --build | |
env: | |
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} | |
LASTFM_API_KEY: ${{ secrets.LASTFM_API_KEY }} | |
- name: Verify Linux build success | |
if: matrix.os == 'ubuntu-20.04' | |
run: | | |
if [ ! -f "./dist/swingmusic" ]; then | |
echo "Build failed" | |
exit 1 | |
fi | |
- name: Verify Windows build success | |
if: matrix.os == 'windows-2019' | |
run: | | |
if (-not (Test-Path "./dist/swingmusic.exe")) { | |
Write-Host "Build failed" | |
exit 1 | |
} | |
- name: Upload Linux binary | |
if: matrix.os == 'ubuntu-20.04' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: swingmusic | |
path: dist/swingmusic | |
retention-days: 1 | |
- name: Upload Windows binary | |
if: matrix.os == 'windows-2019' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: swingmusic.exe | |
path: dist/swingmusic.exe | |
retention-days: 1 | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: write-all | |
steps: | |
- name: Download all binaries | |
uses: actions/download-artifact@v3 | |
- name: Checkout into repo | |
uses: actions/checkout@v2 | |
- name: Upload binaries to GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: | | |
swingmusic | |
swingmusic.exe | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ inputs.tag }} | |
commit: ${{ github.sha }} | |
draft: ${{ inputs.is_draft }} | |
artifactErrorsFailBuild: true | |
name: ${{ inputs.tag }} | |
bodyFile: .github/changelog.md |