Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow to update pixi version, move check-dist to build.yml #46

Merged
merged 9 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 75 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
pull_request:
branches: [main]
merge_group:
schedule:
- cron: 0 6 * * MON

jobs:
build:
Expand All @@ -29,7 +31,7 @@ jobs:

- name: Rebuild the dist/ directory
run: pnpm build

- name: Lint
run: pnpm lint

Expand All @@ -41,10 +43,81 @@ jobs:

- name: Assert latest setup-pixi version is mentioned in README
run: |
set -euo pipefail
latest_version="$(jq -r '.version' package.json)"
count_expected=10
count_actual="$(grep -c "setup-pixi@v$latest_version" README.md || true)"
if [ "$count_actual" -ne "$count_expected" ]; then
echo "::error file=README.md::Expected $count_expected mentions of setup-pixi@v$latest_version in README.md, but found $count_actual."
echo "::error file=README.md::Expected $count_expected mentions of \`setup-pixi@v$latest_version\` in README.md, but found $count_actual."
exit 1
fi

reference-latest-pixi-version-in-readme:
name: Reference latest Pixi version in README
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4

- name: Assert latest pixi version is mentioned in README
run: |
set -euo pipefail
latest_version="$(gh repo view --json latestRelease prefix-dev/pixi | jq -r '.latestRelease.tagName')"
count_expected=1
count_actual="$(grep -c "pixi-version: $latest_version" README.md || true)"
if [ "$count_actual" -ne "$count_expected" ]; then
echo "::error file=README.md::Expected $count_expected mentions of \`pixi-version: $latest_version\` in README.md, but found $count_actual."
sed -i "s/pixi-version: .*/pixi-version: $latest_version/" README.md
exit 1
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create pull request
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38
if: failure() && github.ref_name == 'main'
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Reference latest Pixi version in README
title: Reference latest Pixi version in README
labels: documentation

check-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Rebuild the dist/ directory
run: pnpm build

- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/* | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff

# If index.js or post.js are different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/
48 changes: 0 additions & 48 deletions .github/workflows/check-dist.yml

This file was deleted.

Loading