update #3
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 Release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '0 22 * * *' # Runs at 10 PM UTC every day | ||
env: | ||
VITE_WEB_URL: ${{ vars.VITE_WEB_URL }} | ||
jobs: | ||
check_changes: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_run: ${{ env.SHOULD_RUN }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Check for code changes | ||
run: | | ||
if git diff --quiet @{1.day.ago} HEAD -- ':!.github'; then | ||
echo "SHOULD_RUN=false" >> $GITHUB_ENV | ||
else | ||
echo "SHOULD_RUN=true" >> $GITHUB_ENV | ||
fi | ||
nightly-release: | ||
needs: check_changes | ||
if: ${{ env.SHOULD_RUN == 'true' }} | ||
Check failure on line 32 in .github/workflows/release.yaml GitHub Actions / Nightly ReleaseInvalid workflow file
|
||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-latest] | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
lfs: true | ||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v4 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
cache: 'pnpm' | ||
- name: Install dependencies | ||
run: pnpm i | ||
- name: Set nightly version | ||
shell: bash | ||
run: | | ||
# Get the current version from package.json | ||
if [ -f package.json ]; then | ||
CURRENT_VERSION=$(node -p "require('./package.json').version") | ||
# Remove any existing prerelease identifier (e.g., -alpha.1) | ||
BASE_VERSION=$(echo $CURRENT_VERSION | sed -E 's/(-[a-zA-Z]+\.[0-9]+)$//') | ||
# Generate the nightly version | ||
NIGHTLY_DATE=$(date +'%Y%m%d') | ||
NIGHTLY_VERSION="${BASE_VERSION}-nightly.${NIGHTLY_DATE}" | ||
echo "NIGHTLY_VERSION=$NIGHTLY_VERSION" >> $GITHUB_ENV | ||
# Update version in package.json | ||
if [[ "$RUNNER_OS" == "Windows" ]]; then | ||
sed -i "s/\"version\": \".*\"/\"version\": \"$NIGHTLY_VERSION\"/" package.json | ||
else | ||
sed -i '' "s/\"version\": \".*\"/\"version\": \"$NIGHTLY_VERSION\"/" package.json | ||
fi | ||
echo "Updated version to $NIGHTLY_VERSION" | ||
else | ||
echo "package.json not found" | ||
exit 1 | ||
fi | ||
- name: Build | ||
run: pnpm build | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.os }}-nightly | ||
path: | | ||
.output/chrome-mv3 | ||
retention-days: 7 | ||
- name: Create Nightly Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
name: Nightly ${{ env.NIGHTLY_VERSION }} | ||
draft: false | ||
prerelease: true | ||
files: | | ||
.output/chrome-mv3 | ||
body: | | ||
This is an automated nightly release for testing purposes. | ||
**Warning:** This build may be unstable and is not recommended for production use. | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |