ci: Fix ? #103
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: Eagle Animation - Build & package | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'dev' | |
jobs: | |
release: | |
name: Build & package | |
runs-on: ${{ matrix.versions.os }} | |
strategy: | |
matrix: | |
versions: [ | |
{os: "ubuntu-latest", type: "web" }, | |
{os: "ubuntu-latest", type: "app" }, | |
{os: "windows-latest", type: "app" }, | |
{os: "macos-latest", type: "app" } | |
] | |
steps: | |
- name: Clone source code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 20 | |
# Replace by npm ci when it will be fixed | |
- name: Install dependencies | |
run: | | |
rm package-lock.json | |
npm i --force | |
- name: Packaging Windows | |
if: ${{ (matrix.versions.os == 'windows-latest') && (matrix.versions.type == 'app') }} | |
run: npm run build:win | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Packaging MacOS | |
if: ${{ (matrix.versions.os == 'macos-latest') && (matrix.versions.type == 'app') }} | |
run: npm run build:mac | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Installing Linux bundling dependencies | |
if: ${{ (matrix.versions.os == 'ubuntu-latest') && (matrix.versions.type == 'app') }} | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: flatpak flatpak-builder rpm | |
version: 1.0 | |
- name: Packaging Linux | |
if: ${{ (matrix.versions.os == 'ubuntu-latest') && (matrix.versions.type == 'app') }} | |
run: npm run build:linux | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Packaging Web | |
if: ${{ (matrix.versions.os == 'ubuntu-latest') && (matrix.versions.type == 'web') }} | |
run: | | |
echo "VITE_PUBLIC_URL=${{ secrets.RUN_PUBLIC_URL }}" >> .env | |
echo "VITE_COMMIT_HASH=`git rev-parse HEAD`" >> .env | |
npm run build:web | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install and configure rclone | |
if: ${{ (matrix.versions.os == 'ubuntu-latest') && (matrix.versions.type == 'web') && (github.ref == 'refs/heads/master') }} | |
run: | | |
echo "${{ secrets.RCLONE_CONFIG }}" > /tmp/rclone.conf | |
sudo -v ; curl https://rclone.org/install.sh | sudo bash | |
- name: Upload assets to Cloudflare (Release) | |
if: ${{ (matrix.versions.os == 'ubuntu-latest') && (matrix.versions.type == 'web') && (github.ref == 'refs/heads/master') }} | |
run: | | |
mv out/web/index.html ./ | |
mv out/web/sw.js ./ || true | |
rclone --config /tmp/rclone.conf copy out/web/ r2:/eagle-animation-web/ | |
rclone --config /tmp/rclone.conf copy index.html r2:/eagle-animation-web/ | |
rclone --config /tmp/rclone.conf copy sw.js r2:/eagle-animation-web/ || true |