Reworked Local Variables action block #1967
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: 🦇 Nightly build | |
on: | |
push: | |
branches: | |
- "**" | |
tags-ignore: | |
- "*" | |
jobs: | |
matrix-build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: "" | |
submodules: true | |
- name: Setup NodeJs | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.16.1" | |
# WORKFLOW_NAME is used for productName extension in electron-builder.js | |
- name: Set Env | |
shell: bash | |
run: | | |
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
echo "WORKFLOW_NAME=nightly" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: npm i | |
- name: Update package.json | |
run: node ./build-scripts/nightly-packageModifier.js | |
- name: Build | |
run: npm run export:nightly | |
if: ${{ always() }} | |
env: | |
# gh repo token | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# windows Code signing | |
WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }} | |
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }} | |
# Apple ID | |
APPLE_ID: ${{secrets.APPLE_ID}} | |
APPLE_TEAM_ID: ${{secrets.APPLE_TEAM_ID}} | |
APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} | |
# macOS Code signing | |
CSC_LINK: ${{ secrets.MAC_CSC_LINK }} | |
CSC_KEY_PASSWORD: ${{ secrets.MAC_CSC_KEY_PASSWORD }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-nightly | |
path: build/*.* | |
publish-nightly-release: | |
runs-on: ubuntu-latest | |
needs: matrix-build | |
if: ${{ github.ref == 'refs/heads/stable' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-tags: true | |
fetch-depth: 0 | |
- name: Read version from package.json | |
id: get_version | |
run: | | |
version=$(cat package.json | jq -r '.version') | |
tag_name="v${version}-nightly" | |
echo "Tag name: $tag_name" | |
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT | |
- name: Delete all releases by name | |
id: delete_releases_by_name | |
run: | | |
release_name="Release Nightly Version" # Replace with the release name you want to delete | |
echo "Deleting all releases with the name: $release_name" | |
# Fetch all releases | |
releases=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
"https://api.github.com/repos/${{ github.repository }}/releases") | |
# Find and delete all releases matching the given name | |
echo "$releases" | jq -c --arg release_name "$release_name" '.[] | select(.name == $release_name) | .id' | while read release_id; do | |
echo "Deleting release with ID: $release_id" | |
# Delete the release by ID | |
curl -s -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
"https://api.github.com/repos/${{ github.repository }}/releases/$release_id" | |
echo "Deleted release with ID: $release_id" | |
done | |
- name: Remove Nightly Tags | |
run: | | |
# Configure Git | |
echo "Configuring Git..." | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
# Get all tags containing "-nightly" | |
echo "Retrieving all tags containing '-nightly'..." | |
nightly_tags=$(git tag -l "*-nightly") | |
echo "Nightly tags found: $nightly_tags" | |
# Loop through each nightly tag and delete it locally and remotely | |
if [ -z "$nightly_tags" ]; then | |
echo "No nightly tags found. Exiting..." | |
else | |
for tag in $nightly_tags; do | |
echo "Deleting tag: $tag" | |
git tag -d "$tag" # Delete tag locally | |
git push origin ":refs/tags/$tag" | |
done | |
fi | |
echo "Tag deletion process completed." | |
- name: Download all nightly artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
# Use the pattern to match all nightly artifacts | |
pattern: "*-nightly" # This will match ubuntu-latest-nightly, windows-latest-nightly, and macos-latest-nightly | |
path: build/ # Path to save the downloaded artifacts | |
merge-multiple: true | |
- name: Release Nightly | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: Release Nightly Version | |
tag_name: ${{ steps.get_version.outputs.tag_name }} | |
files: build/*.* | |
draft: false | |
prerelease: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
linux-unit-test: | |
name: Linux Unit Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: "" | |
submodules: true | |
- name: Setup nodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.16.1" | |
- name: Install dependencies | |
run: npm i | |
- name: "Run unit tests" | |
run: | | |
npm test >> unit_test.txt | |
cat unit_test.txt | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-unit-test | |
path: unit_test.txt | |
- uses: tsickert/discord-webhook@v4.0.0 | |
with: | |
webhook-url: ${{ secrets.DISCORD_DEV_WEBHOOK }} | |
content: "Heyo, here are the editor unit test results!" | |
filename: "unit_test.txt" |