mirror of
https://github.com/JuLi0n21/pwa-player.git
synced 2026-04-19 15:30:05 +00:00
split up workflows
This commit is contained in:
58
.github/workflows/backend.yml
vendored
Normal file
58
.github/workflows/backend.yml
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
name: Build Backend
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'grpc-backend/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'grpc-backend/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-backend:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Protobuf
|
||||
run: |
|
||||
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-x86_64.zip
|
||||
unzip protoc-21.12-linux-x86_64.zip -d protoc3
|
||||
sudo mv protoc3/bin/* /usr/local/bin/
|
||||
sudo mv protoc3/include/* /usr/local/include/
|
||||
rm -rf protoc*
|
||||
|
||||
- name: Install protoc-gen plugins
|
||||
run: |
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest
|
||||
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest
|
||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Generate protobuf code
|
||||
run: |
|
||||
protoc \
|
||||
-I grpc-backend/proto \
|
||||
-I grpc-backend/googleapis \
|
||||
--go_out=grpc-backend/gen --go_opt=paths=source_relative \
|
||||
--go-grpc_out=grpc-backend/gen --go-grpc_opt=paths=source_relative \
|
||||
--grpc-gateway_out=grpc-backend/gen --grpc-gateway_opt=paths=source_relative \
|
||||
--openapiv2_out=grpc-backend/gen/swagger \
|
||||
grpc-backend/proto/osu_music.proto
|
||||
|
||||
- name: Build osu-server binary
|
||||
working-directory: grpc-backend
|
||||
run: go build -o osu-server .
|
||||
|
||||
- name: Upload osu-server binary artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: osu-server
|
||||
path: grpc-backend/osu-server
|
||||
39
.github/workflows/frontend.yml
vendored
Normal file
39
.github/workflows/frontend.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Build Frontend Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'frontend/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'frontend/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-frontend:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Download osu-server binary
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: osu-server
|
||||
path: grpc-backend
|
||||
|
||||
- name: Build Frontend Docker image
|
||||
run: |
|
||||
docker build -t juli0n21/frontend-container:latest -t juli0n21/frontend-container:${{ github.sha }} ./frontend
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
env:
|
||||
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
run: echo "${DOCKER_HUB_TOKEN}" | docker login -u "${DOCKER_HUB_USERNAME}" --password-stdin
|
||||
|
||||
- name: Push Frontend Docker image
|
||||
run: |
|
||||
docker push juli0n21/frontend-container:${{ github.sha }}
|
||||
docker push juli0n21/frontend-container:latest
|
||||
141
.github/workflows/osumusic.yml
vendored
141
.github/workflows/osumusic.yml
vendored
@@ -1,141 +0,0 @@
|
||||
name: Docker Build and Push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
detect-changes:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
proxy: ${{ steps.set.outputs.proxy }}
|
||||
frontend: ${{ steps.set.outputs.frontend }}
|
||||
backend: ${{ steps.set.outputs.backend }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Detect file changes
|
||||
id: set
|
||||
run: |
|
||||
git fetch origin main
|
||||
FILES=$(git diff --name-only origin/main...HEAD || true)
|
||||
echo "$FILES"
|
||||
|
||||
echo "proxy=false" >> $GITHUB_OUTPUT
|
||||
echo "frontend=false" >> $GITHUB_OUTPUT
|
||||
echo "backend=false" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "$FILES" | grep -q '^proxy/' && echo "proxy=true" >> $GITHUB_OUTPUT
|
||||
echo "$FILES" | grep -q '^frontend/' && echo "frontend=true" >> $GITHUB_OUTPUT
|
||||
echo "$FILES" | grep -q '^grpc-backend/' && echo "backend=true" >> $GITHUB_OUTPUT
|
||||
|
||||
build-backend:
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.backend == 'true' || github.event_name == 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Protobuf
|
||||
run: |
|
||||
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-x86_64.zip
|
||||
unzip protoc-21.12-linux-x86_64.zip -d protoc3
|
||||
sudo mv protoc3/bin/* /usr/local/bin/
|
||||
sudo mv protoc3/include/* /usr/local/include/
|
||||
rm -rf protoc*
|
||||
|
||||
- name: Install protoc-gen plugins
|
||||
run: |
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest
|
||||
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest
|
||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Generate protobuf code
|
||||
run: |
|
||||
protoc \
|
||||
-I grpc-backend/proto \
|
||||
-I grpc-backend/googleapis \
|
||||
--go_out=grpc-backend/gen --go_opt=paths=source_relative \
|
||||
--go-grpc_out=grpc-backend/gen --go-grpc_opt=paths=source_relative \
|
||||
--grpc-gateway_out=grpc-backend/gen --grpc-gateway_opt=paths=source_relative \
|
||||
--openapiv2_out=grpc-backend/gen/swagger \
|
||||
grpc-backend/proto/osu_music.proto
|
||||
|
||||
- name: Build osu-server binary
|
||||
working-directory: grpc-backend
|
||||
run: go build -o osu-server .
|
||||
|
||||
- name: Upload osu-server binary artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: osu-server
|
||||
path: grpc-backend/osu-server
|
||||
|
||||
build-proxy:
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.proxy == 'true' || github.event_name == 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Download osu-server binary
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: osu-server
|
||||
path: grpc-backend
|
||||
|
||||
- name: Build Proxy Docker image
|
||||
run: |
|
||||
docker build -t juli0n21/proxy-container:latest -t juli0n21/proxy-container:${{ github.sha }} ./proxy
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
env:
|
||||
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
run: echo "${DOCKER_HUB_TOKEN}" | docker login -u "${DOCKER_HUB_USERNAME}" --password-stdin
|
||||
|
||||
- name: Push Proxy Docker image
|
||||
run: |
|
||||
docker push juli0n21/proxy-container:${{ github.sha }}
|
||||
docker push juli0n21/proxy-container:latest
|
||||
|
||||
build-frontend:
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.frontend == 'true' || github.event_name == 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Download osu-server binary
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: osu-server
|
||||
path: grpc-backend
|
||||
|
||||
- name: Build Frontend Docker image
|
||||
run: |
|
||||
docker build -t juli0n21/frontend-container:latest -t juli0n21/frontend-container:${{ github.sha }} ./frontend
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
env:
|
||||
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
run: echo "${DOCKER_HUB_TOKEN}" | docker login -u "${DOCKER_HUB_USERNAME}" --password-stdin
|
||||
|
||||
- name: Push Frontend Docker image
|
||||
run: |
|
||||
docker push juli0n21/frontend-container:${{ github.sha }}
|
||||
docker push juli0n21/frontend-container:latest
|
||||
39
.github/workflows/proxy.yml
vendored
Normal file
39
.github/workflows/proxy.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Build Proxy Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'proxy/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'proxy/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-proxy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Download osu-server binary
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: osu-server
|
||||
path: grpc-backend
|
||||
|
||||
- name: Build Proxy Docker image
|
||||
run: |
|
||||
docker build -t juli0n21/proxy-container:latest -t juli0n21/proxy-container:${{ github.sha }} ./proxy
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
env:
|
||||
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
run: echo "${DOCKER_HUB_TOKEN}" | docker login -u "${DOCKER_HUB_USERNAME}" --password-stdin
|
||||
|
||||
- name: Push Proxy Docker image
|
||||
run: |
|
||||
docker push juli0n21/proxy-container:${{ github.sha }}
|
||||
docker push juli0n21/proxy-container:latest
|
||||
Reference in New Issue
Block a user