Skip to content

Release Pipeline

Release Pipeline #62

Workflow file for this run

name: Release Pipeline
on:
push:
tags:
- v*
permissions:
pages: write
id-token: write
contents: write
jobs:
release-windows:
name: Build and release for Windows
runs-on: windows-latest
# defaults:
# run:
# shell: msys2 {0}
steps:
# - uses: msys2/setup-msys2@v2
# with:
# update: true
# install: >-
# git
# make
# cmake
# mingw-w64-x86_64-gcc
- name: Install Glfw3
run: |
choco install mingw make cmake git
- name: Checkout code
uses: actions/checkout@v2
- name: Set commit hash
run: |
echo "SHA_SHORT=$(git rev-parse --short "$env:GITHUB_SHA")" >> "$env:GITHUB_ENV"
- name: Build and compile
run: |
mkdir build && cd build && cmake .. && cmake --build . --config Release
dir
dir Release
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/json_x_glfw_opengl3-windows-amd64_${{ env.SHA_SHORT }}.exe
asset_name: json_x_glfw_opengl3-windows-amd64_${{ env.SHA_SHORT }}.exe
tag: ${{ github.ref }}
# release-macos:
# name: Build and release for MacOS
# runs-on: macos-14
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Install Glfw3
# run: |
# brew install cmake
# - name: Set commit hash
# run: |
# echo "SHA_SHORT=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
# - name: Build and compile
# run: |
# mkdir build && cd build && cmake .. && make
# - name: Upload binaries to release
# uses: svenstaro/upload-release-action@v2
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# file: build/json_x_glfw_opengl3-macos-arm64_${{ env.SHA_SHORT }}
# asset_name: json_x_glfw_opengl3-macos-arm64_${{ env.SHA_SHORT }}
# tag: ${{ github.ref }}
# release-linux:
# name: Build and release for Linux
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Install Glfw3
# run: |
# sudo apt-get update
# sudo apt-get install libegl1-mesa-dev libwayland-dev libxkbcommon-dev xorg-dev
# - name: Set commit hash
# run: |
# echo "SHA_SHORT=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
# - name: Build and compile
# run: |
# mkdir build && cd build && cmake .. && make
# - name: Upload binaries to release
# uses: svenstaro/upload-release-action@v2
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# file: build/json_x_glfw_opengl3-linux-amd64_${{ env.SHA_SHORT }}
# asset_name: json_x_glfw_opengl3-linux-amd64_${{ env.SHA_SHORT }}
# tag: ${{ github.ref }}
web-build:
name: Web page build
# needs: [release-linux, release-macos, release-windows]
needs: [release-windows]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set commit hash
run: |
echo "SHA_SHORT=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
- name: Checkout to web branch
uses: actions/checkout@v2
with:
ref: web
- name: Compile HTML
run: |
export LINUX_DOWNLOAD_HREF=https://github.com/sithumonline/json_x/releases/download/${{ github.ref_name }}/json_x_glfw_opengl3-linux-amd64_${{ env.SHA_SHORT }}
export LINUX_DOWNLOAD=json_x_glfw_opengl3-linux-amd64_${{ env.SHA_SHORT }}
export MACOS_DOWNLOAD_HREF=https://github.com/sithumonline/json_x/releases/download/${{ github.ref_name }}/json_x_glfw_opengl3-macos-arm64_${{ env.SHA_SHORT }}
export MACOS_DOWNLOAD=json_x_glfw_opengl3-macos-arm64_${{ env.SHA_SHORT }}
export WINDOWS_DOWNLOAD_HREF=https://github.com/sithumonline/json_x/releases/download/${{ github.ref_name }}/json_x_glfw_opengl3-windows-amd64_${{ env.SHA_SHORT }}.exe
export WINDOWS_DOWNLOAD=json_x_glfw_opengl3-windows-amd64_${{ env.SHA_SHORT }}
mkdir dist
sed -e "s#linux-download-href#$LINUX_DOWNLOAD_HREF#g" \
-e "s#linux-download#$LINUX_DOWNLOAD#g" \
-e "s#macos-download-href#$MACOS_DOWNLOAD_HREF#g" \
-e "s#macos-download#$MACOS_DOWNLOAD#g" \
-e "s#windows-download-href#$WINDOWS_DOWNLOAD_HREF#g" \
-e "s#windows-download#$WINDOWS_DOWNLOAD#g" \
index.html.tmp > dist/index.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "./dist"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1