Build Server Template #55
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: Build Server Template | |
on: | |
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch | |
workflow_dispatch: | |
schedule: | |
- cron: '0 18 * * 5' | |
push: | |
branches: [ '*' ] | |
paths-ignore: | |
- "**/docs/**" | |
- "**.md" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
PROJECT_NAME: server-template | |
SERVICE_NAME: auth | |
WORKSPACE: ${{ github.workspace }}/my_workspace | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Workspace Directory | |
run: | | |
mkdir -p ${{ env.WORKSPACE }}/services/${{ env.SERVICE_NAME }} | |
echo '[workspace]' >> ${{ env.WORKSPACE }}/Cargo.toml | |
echo 'resolver = "2"' >> ${{ env.WORKSPACE }}/Cargo.toml | |
echo 'members = ["server", "services/${{env.SERVICE_NAME}}"]' >> ${{ env.WORKSPACE }}/Cargo.toml | |
- name: Clone Service Template | |
run: | | |
git clone https://github.com/codeitlikemiley/service_template | |
- name: Generate Server | |
uses: cargo-generate/[email protected] | |
with: | |
name: ${{ env.PROJECT_NAME }} | |
arguments: "--branch main --define server_name=default --define service_name=auth" | |
- name: Move Server | |
run: | | |
mv ${{ env.PROJECT_NAME }} ${{ runner.temp }}/ | |
mv ${{ runner.temp }}/${{ env.PROJECT_NAME }} ${{ env.WORKSPACE }}/server | |
- name: Generate Auth Service | |
uses: cargo-generate/[email protected] | |
with: | |
name: ${{ env.SERVICE_NAME }} | |
template: "./service_template" | |
arguments: "--branch main --define service_description=default --define rpc_method=make" | |
- name: Move Auth Service | |
run: | | |
mv ${{ env.SERVICE_NAME }} ${{ runner.temp }}/ | |
mv ${{ runner.temp }}/${{ env.SERVICE_NAME }} ${{ env.WORKSPACE }}/services/ | |
- name: List Auth Service Directory | |
run: | | |
ls -la ${{ env.WORKSPACE }}/services/${{ env.SERVICE_NAME }}/ | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v2 | |
- name: Check Workspace | |
run: | | |
cd ${{ env.WORKSPACE }} | |
cargo check |