mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-06 19:25:34 +00:00
update workflow
This commit is contained in:
parent
e96e2f697c
commit
bf8906a4a0
313
.github/workflows/release.yml
vendored
313
.github/workflows/release.yml
vendored
@ -24,142 +24,189 @@ on:
|
|||||||
- false
|
- false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
# build:
|
||||||
strategy:
|
# strategy:
|
||||||
matrix:
|
# matrix:
|
||||||
os: [ubuntu-20.04, windows-2019]
|
# os: [ubuntu-20.04, windows-2019]
|
||||||
runs-on: ${{ matrix.os }}
|
# runs-on: ${{ matrix.os }}
|
||||||
name: Create binary on ${{ matrix.os }}
|
# name: Create binary on ${{ matrix.os }}
|
||||||
steps:
|
# steps:
|
||||||
- name: Clone client
|
# - name: Clone client
|
||||||
uses: actions/checkout@v3
|
# uses: actions/checkout@v3
|
||||||
- name: Setup Node 16
|
# - name: Setup Node 16
|
||||||
uses: actions/setup-node@v3
|
# uses: actions/setup-node@v3
|
||||||
with:
|
# with:
|
||||||
node-version: 16.x
|
# node-version: 16.x
|
||||||
- name: Install yarn
|
# - name: Install yarn
|
||||||
run: |
|
# run: |
|
||||||
npm install -g yarn
|
# npm install -g yarn
|
||||||
- name: Clone client
|
# - name: Clone client
|
||||||
run: |
|
# run: |
|
||||||
git clone https://github.com/swing-opensource/swingmusic-client.git
|
# git clone https://github.com/swing-opensource/swingmusic-client.git
|
||||||
- name: Install dependencies & Build client
|
# - name: Install dependencies & Build client
|
||||||
run: |
|
# run: |
|
||||||
cd swingmusic-client
|
# cd swingmusic-client
|
||||||
yarn install
|
# yarn install
|
||||||
yarn build --outDir ../client
|
# yarn build --outDir ../client
|
||||||
cd ..
|
# cd ..
|
||||||
- name: Install Python 3.10.11
|
# - name: Install Python 3.10.11
|
||||||
uses: actions/setup-python@v2
|
# uses: actions/setup-python@v2
|
||||||
with:
|
# with:
|
||||||
python-version: "3.10.11"
|
# python-version: "3.10.11"
|
||||||
- name: Install Poetry
|
# - name: Install Poetry
|
||||||
run: |
|
# run: |
|
||||||
pip install poetry
|
# pip install poetry
|
||||||
- name: Install dependencies
|
# - name: Install dependencies
|
||||||
run: |
|
# run: |
|
||||||
python -m poetry install
|
# python -m poetry install
|
||||||
- name: Build server
|
# - name: Build server
|
||||||
run: |
|
# run: |
|
||||||
python -m poetry run python manage.py --build
|
# python -m poetry run python manage.py --build
|
||||||
env:
|
# env:
|
||||||
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
|
# POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
|
||||||
LASTFM_API_KEY: ${{ secrets.LASTFM_API_KEY }}
|
# LASTFM_API_KEY: ${{ secrets.LASTFM_API_KEY }}
|
||||||
- name: Verify Linux build success
|
# - name: Verify Linux build success
|
||||||
if: matrix.os == 'ubuntu-20.04'
|
# if: matrix.os == 'ubuntu-20.04'
|
||||||
run: |
|
# run: |
|
||||||
if [ ! -f "./dist/swingmusic" ]; then
|
# if [ ! -f "./dist/swingmusic" ]; then
|
||||||
echo "Build failed"
|
# echo "Build failed"
|
||||||
exit 1
|
# exit 1
|
||||||
fi
|
# fi
|
||||||
- name: Verify Windows build success
|
# - name: Verify Windows build success
|
||||||
if: matrix.os == 'windows-2019'
|
# if: matrix.os == 'windows-2019'
|
||||||
run: |
|
# run: |
|
||||||
if (-not (Test-Path "./dist/swingmusic.exe")) {
|
# if (-not (Test-Path "./dist/swingmusic.exe")) {
|
||||||
Write-Host "Build failed"
|
# Write-Host "Build failed"
|
||||||
exit 1
|
# exit 1
|
||||||
}
|
# }
|
||||||
- name: Upload Linux binary
|
# - name: Upload Linux binary
|
||||||
if: matrix.os == 'ubuntu-20.04'
|
# if: matrix.os == 'ubuntu-20.04'
|
||||||
uses: actions/upload-artifact@v3
|
# uses: actions/upload-artifact@v3
|
||||||
with:
|
# with:
|
||||||
name: linux
|
# name: linux
|
||||||
path: dist/swingmusic
|
# path: dist/swingmusic
|
||||||
retention-days: 1
|
# retention-days: 1
|
||||||
- name: Upload Windows binary
|
# - name: Upload Windows binary
|
||||||
if: matrix.os == 'windows-2019'
|
# if: matrix.os == 'windows-2019'
|
||||||
uses: actions/upload-artifact@v3
|
# uses: actions/upload-artifact@v3
|
||||||
with:
|
# with:
|
||||||
name: win32
|
# name: win32
|
||||||
path: dist/swingmusic.exe
|
# path: dist/swingmusic.exe
|
||||||
retention-days: 1
|
# retention-days: 1
|
||||||
|
build_armv7:
|
||||||
release:
|
|
||||||
name: Create New Release
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
name: Create binary on armv7
|
||||||
permissions: write-all
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout into repo
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v3
|
- uses: uraimo/run-on-arch-action@v2
|
||||||
- name: Download all binaries
|
name: Build on armv7
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
- name: Upload binaries to GitHub Release
|
|
||||||
uses: ncipollo/release-action@v1
|
|
||||||
with:
|
with:
|
||||||
artifacts: "./linux/swingmusic, ./win32/swingmusic.exe"
|
arch: armv7
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
distro: ubuntu18.04
|
||||||
tag: ${{ inputs.tag }}
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
commit: ${{ github.sha }}
|
setup: |
|
||||||
draft: ${{ inputs.is_draft }}
|
mkdir -p ${PWD}/armv7
|
||||||
artifactErrorsFailBuild: true
|
dockerRunArgs: |
|
||||||
name: ${{ inputs.tag }}
|
-v ${PWD}/armv7:/armv7
|
||||||
bodyFile: .github/changelog.md
|
shell: /bin/sh
|
||||||
makeLatest: ${{ inputs.is_latest }}
|
install: |
|
||||||
docker:
|
apt-get update
|
||||||
name: Build and push Docker image
|
apt-get install -y ca-certificates curl gnupg git software-properties-common
|
||||||
runs-on: ubuntu-latest
|
mkdir -p /etc/apt/keyrings
|
||||||
needs: build
|
sudo add-apt-repository ppa:deadsnakes/ppa -y
|
||||||
permissions: write-all
|
sudo apt install Python3.10
|
||||||
steps:
|
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||||
- name: Checkout into repo
|
NODE_MAJOR=16
|
||||||
uses: actions/checkout@v3
|
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
|
||||||
- name: Download linux binary
|
apt-get update
|
||||||
uses: actions/download-artifact@v3
|
apt-get install -y nodejs
|
||||||
with:
|
npm install -g yarn
|
||||||
name: linux
|
curl -sSL https://install.python-poetry.org | python3 -
|
||||||
path: dist
|
run: |
|
||||||
- name: Set up QEMU
|
git clone https://github.com/swing-opensource/swingmusic-client.git --depth 1
|
||||||
uses: docker/setup-qemu-action@v1
|
cd swingmusic-client
|
||||||
|
yarn install
|
||||||
- name: Set up Docker Buildx
|
yarn build --outDir ../client
|
||||||
id: buildx
|
cd ..
|
||||||
uses: docker/setup-buildx-action@v1
|
python3.10 -m poetry install
|
||||||
|
python3.10 -m poetry run python manage.py --build
|
||||||
- name: Login to GHCR
|
mv dist/swingmusic /dist/armv7swingmusic
|
||||||
uses: docker/login-action@v1
|
mv dist/armv7swingmusic /armv7
|
||||||
with:
|
- name: echo directory
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta # you'll use this in the next step
|
|
||||||
uses: docker/metadata-action@v3
|
|
||||||
with:
|
|
||||||
# list of Docker images to use as base name for tags
|
|
||||||
images: |
|
|
||||||
ghcr.io/${{ github.repository }}
|
|
||||||
- name: print directory
|
|
||||||
run: |
|
run: |
|
||||||
ls -R
|
ls -R
|
||||||
- name: Build and push
|
- name: Upload armv7 binary
|
||||||
uses: docker/build-push-action@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
context: .
|
name: armv7
|
||||||
platforms: linux/amd64,linux/arm
|
path: armv7/armv7swingmusic
|
||||||
push: true
|
retention-days: 1
|
||||||
tags: ghcr.io/${{github.repository}}:${{inputs.tag}}, ${{env.LATEST_TAG}}
|
# release:
|
||||||
labels: org.opencontainers.image.title=Docker
|
# name: Create New Release
|
||||||
env:
|
# runs-on: ubuntu-latest
|
||||||
LATEST_TAG: ${{ inputs.is_latest == 'true' && format('ghcr.io/{0}:latest', github.repository) || '' }}
|
# needs: build
|
||||||
|
# permissions: write-all
|
||||||
|
# steps:
|
||||||
|
# - name: Checkout into repo
|
||||||
|
# uses: actions/checkout@v3
|
||||||
|
# - name: Download all binaries
|
||||||
|
# uses: actions/download-artifact@v3
|
||||||
|
# - name: Upload binaries to GitHub Release
|
||||||
|
# uses: ncipollo/release-action@v1
|
||||||
|
# with:
|
||||||
|
# artifacts: "./linux/swingmusic, ./win32/swingmusic.exe, ./armv7/armv7swingmusic"
|
||||||
|
# token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# tag: ${{ inputs.tag }}
|
||||||
|
# commit: ${{ github.sha }}
|
||||||
|
# draft: ${{ inputs.is_draft }}
|
||||||
|
# artifactErrorsFailBuild: true
|
||||||
|
# name: ${{ inputs.tag }}
|
||||||
|
# bodyFile: .github/changelog.md
|
||||||
|
# makeLatest: ${{ inputs.is_latest }}
|
||||||
|
# docker:
|
||||||
|
# name: Build and push Docker image
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# needs: build
|
||||||
|
# permissions: write-all
|
||||||
|
# steps:
|
||||||
|
# - name: Checkout into repo
|
||||||
|
# uses: actions/checkout@v3
|
||||||
|
# - name: Download linux binary
|
||||||
|
# uses: actions/download-artifact@v3
|
||||||
|
# with:
|
||||||
|
# name: linux
|
||||||
|
# path: dist
|
||||||
|
# - name: Set up QEMU
|
||||||
|
# uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
|
# - name: Set up Docker Buildx
|
||||||
|
# id: buildx
|
||||||
|
# uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
# - name: Login to GHCR
|
||||||
|
# uses: docker/login-action@v1
|
||||||
|
# with:
|
||||||
|
# registry: ghcr.io
|
||||||
|
# username: ${{ github.repository_owner }}
|
||||||
|
# password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# - name: Docker meta
|
||||||
|
# id: meta # you'll use this in the next step
|
||||||
|
# uses: docker/metadata-action@v3
|
||||||
|
# with:
|
||||||
|
# # list of Docker images to use as base name for tags
|
||||||
|
# images: |
|
||||||
|
# ghcr.io/${{ github.repository }}
|
||||||
|
# - name: print directory
|
||||||
|
# run: |
|
||||||
|
# ls -R
|
||||||
|
# - name: Build and push
|
||||||
|
# uses: docker/build-push-action@v2
|
||||||
|
# with:
|
||||||
|
# context: .
|
||||||
|
# platforms: linux/amd64,linux/arm
|
||||||
|
# push: true
|
||||||
|
# tags: ghcr.io/${{github.repository}}:${{inputs.tag}}, ${{env.LATEST_TAG}}
|
||||||
|
# labels: org.opencontainers.image.title=Docker
|
||||||
|
# env:
|
||||||
|
# LATEST_TAG: ${{ inputs.is_latest == 'true' && format('ghcr.io/{0}:latest', github.repository) || '' }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user