Skip to content

デプロイ用のワークフローの作成 #15

デプロイ用のワークフローの作成

デプロイ用のワークフローの作成 #15

Workflow file for this run

name: Deploy
on:
pull_request:
branches:
- main
concurrency:
group: deploy_app
cancel-in-progress: true
jobs:
prepare:
runs-on: ubuntu-22.04
outputs:
VERSION_NO: ${{ steps.tag_check.outputs.VERSION_NO }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Tag check
id: tag_check
run: |
tag="${{ github.ref_name }}"
tag="v0.42.0" # debug
version_no=$(cat app/main.cpp | grep "app.setApplicationVersion" | grep -oE "[0-9]+.[0-9]+.[0-9]+")
echo "VERSION_NO=${version_no}" >> "$GITHUB_OUTPUT"
echo "Version No: $version_no"
echo "Tag: $tag"
if [[ "$tag" = "v${version_no}" ]]; then
ret=0
echo ok
else
ret=1
echo Please format the tag as "vX.Y.Z".
fi
exit $ret
build-for-ubuntu:
runs-on: ubuntu-22.04
needs: prepare
outputs:
ARCHIVE_PATH: ${{ steps.build.outputs.ARCHIVE_PATH }}
steps:
- name: Build for Ubuntu
id: build
env:
VERSION_NO: ${{ needs.prepare.outputs.VERSION_NO }}
run: |
echo "Make for Ubuntu"
mkdir -p deploy-hagoromo/hagoromo
echo "for linux" > deploy-hagoromo/hagoromo/hagoromo.txt
cd deploy-hagoromo
zip -r hagoromo_${VERSION_NO}_linux.zip hagoromo/
ls -l
echo "ARCHIVE_PATH=deploy-hagoromo/hagoromo_${VERSION_NO}_linux.zip" >> "$GITHUB_OUTPUT"
cd ..
- name: Upload a archive
uses: actions/upload-artifact@v4
with:
name: archive_for_linux
path: ${{ steps.build.outputs.ARCHIVE_PATH }}
build-for-windows:
runs-on: windows-latest
needs: prepare
outputs:
ARCHIVE_PATH: ${{ steps.build.outputs.ARCHIVE_PATH }}
steps:
# - name: Configure build for x86_64
# uses: ilammy/msvc-dev-cmd@v1
# with:
# arch: x86_64
# - name: Install dependencies (windows)
# run: choco install ninja
# - name: Install Qt
# uses: jurplel/install-qt-action@v4
# with:
# version: '6.8.1'
# host: 'windows'
# target: 'desktop'
# arch: 'win64_msvc2022_64'
# modules: 'qt5compat qtwebsockets qthttpserver qtshadertools qtimageformats qtscxml'
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# submodules: recursive
- name: Build for Windows
id: build
env:
VERSION_NO: ${{ needs.prepare.outputs.VERSION_NO }}
run: |
echo "Make for Windows"
mkdir deploy-hagoromo/hagoromo
echo "for windows" > deploy-hagoromo/hagoromo/hagoromo.txt
Compress-Archive -Path deploy-hagoromo\hagoromo -DestinationPath ("deploy-hagoromo\hagoromo_" + $VERSION_NO + "_windows.zip")
ls
echo ("ARCHIVE_PATH=deploy-hagoromo/hagoromo_" + $VERSION_NO + "_windows.zip") >> "$env:GITHUB_OUTPUT"
cd ..
- name: Upload a archive
uses: actions/upload-artifact@v4
with:
name: archive_for_windows
path: ${{ steps.build.outputs.ARCHIVE_PATH }}
build-for-mac:
runs-on: macos-latest
needs: prepare
outputs:
ARCHIVE_PATH: ${{ steps.build.outputs.ARCHIVE_PATH }}
steps:
- name: Build for Mac
id: build
env:
VERSION_NO: ${{ needs.prepare.outputs.VERSION_NO }}
run: |
echo "Make for Mac"
mkdir -p deploy-hagoromo/hagoromo
echo "for linux" > deploy-hagoromo/hagoromo/hagoromo.txt
cd deploy-hagoromo
zip -r hagoromo_${VERSION_NO}_mac.zip hagoromo/
ls -l
echo "ARCHIVE_PATH=deploy-hagoromo/hagoromo_${VERSION_NO}_mac.zip" >> "$GITHUB_OUTPUT"
cd ..
- name: Upload a archive
uses: actions/upload-artifact@v4
with:
name: archive_for_mac
path: ${{ steps.build.outputs.ARCHIVE_PATH }}
make-release:
runs-on: ubuntu-22.04
needs: [build-for-ubuntu, build-for-windows, build-for-mac]
steps:
- name: Download archives
uses: actions/download-artifact@v4
with:
name: archive_for_linux
- name: Make relelase
run: |
ls -l
echo "Make release : ${{ needs.build-for-ubuntu.outputs.ARCHIVE_PATH }}"
echo "Make release : ${{ needs.build-for-windows.outputs.ARCHIVE_PATH }}"
echo "Make release : ${{ needs.build-for-mac.outputs.ARCHIVE_PATH }}"