Skip to content

Commit 2a0575f

Browse files
Main simplify release (#91)
* get full git history first * remove deprecated auth warning * use pnpm publish instead of npm * @instructure.ai/[email protected] * lint * @instructure.ai/[email protected] * Update .github/workflows/release-package.yml Co-authored-by: Copilot <[email protected]> * Update .github/workflows/release-package.yml Co-authored-by: Copilot <[email protected]> * update build script * properly invoke custom build script * simplify release script * exit early when no change in ./apps * easier PR prefix validation * use fetch-depth: 0 * robust git dif * use proper exit codes * use conditional yaml * @instructure.ai/[email protected] * don't force push tags * @instructure.ai/[email protected] * use workflow_run as trigger. --------- Co-authored-by: Copilot <[email protected]>
1 parent 4fb1762 commit 2a0575f

File tree

1 file changed

+59
-53
lines changed

1 file changed

+59
-53
lines changed
Lines changed: 59 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
2-
name: Release Package
1+
name: Release Packages
32

43
on:
5-
push:
6-
tags:
7-
- '@instructure.ai/*@*.*.*'
4+
workflow_run:
5+
workflows: ["Tag on Merge"]
6+
types:
7+
- completed
88

99
permissions:
1010
id-token: write
@@ -14,61 +14,67 @@ jobs:
1414
publish:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- name: Remove deprecated always-auth from .npmrc
18-
run: |
19-
if [ -f "$NPM_CONFIG_USERCONFIG" ]; then
20-
sed -i.bak '/always-auth/d' "$NPM_CONFIG_USERCONFIG"
21-
fi
22-
env:
23-
NPM_CONFIG_USERCONFIG: $HOME/.npmrc
2417
- uses: actions/checkout@v4
25-
26-
27-
- uses: actions/setup-node@v4
2818
with:
29-
node-version: '24'
30-
registry-url: 'https://registry.npmjs.org'
31-
32-
- name: Install pnpm
33-
run: npm install -g pnpm
19+
fetch-depth: 0
3420

35-
- name: Install dependencies with pnpm
36-
run: pnpm install --frozen-lockfile
21+
- name: Fetch all tags
22+
run: git fetch --tags
3723

38-
- name: Extract package name
39-
id: pkgname
40-
run: echo "PKG_NAME=$(echo \"${GITHUB_REF_NAME}\" | sed -E 's/@instructure.ai\/([^@]+)@.*/\1/')" >> $GITHUB_ENV
41-
42-
- name: Build
24+
- name: Find all new package tags on this commit
25+
id: find_tags
4326
run: |
44-
if [ "$PKG_NAME" = "shared-configs" ]; then
45-
echo "Skipping build for @instructure.ai/shared-configs."
46-
else
47-
echo "Building package: $PKG_NAME"
48-
pnpm build package "$PKG_NAME"
27+
TAGS=$(git tag --points-at HEAD | grep -E '^@instructure.ai/.+@([0-9]+\.[0-9]+\.[0-9]+)$' || true)
28+
if [[ -z "$TAGS" ]]; then
29+
echo "No new matching tags found on this commit."
30+
exit 0
4931
fi
32+
# Save tags list for next steps
33+
echo "tags<<EOF" >> $GITHUB_ENV
34+
echo "$TAGS" >> $GITHUB_ENV
35+
echo "EOF" >> $GITHUB_ENV
5036
51-
- name: Test
37+
- name: Release each package tag
38+
if: env.tags != ''
5239
run: |
53-
if [ "$PKG_NAME" = "shared-configs" ]; then
54-
echo "Skipping test for @instructure.ai/shared-configs."
55-
else
56-
pnpm test
57-
fi
40+
IFS=$'\n'
41+
for TAG in $tags; do
42+
PKG_NAME=$(echo "$TAG" | sed -E 's/@instructure.ai\/([^@]+)@.*/\1/')
43+
echo "Processing release for tag: $TAG (package: $PKG_NAME)"
5844
59-
- name: Publish package with pnpm
60-
run: |
61-
if [ "$PKG_NAME" = "shared-configs" ]; then
62-
echo "Skipping publish for @instructure.ai/shared-configs."
63-
else
64-
pnpm publish
65-
fi
45+
# Remove deprecated always-auth from .npmrc
46+
if [ -f "$HOME/.npmrc" ]; then
47+
sed -i.bak '/always-auth/d' "$HOME/.npmrc"
48+
fi
6649
67-
- name: Create GitHub Release
68-
uses: softprops/action-gh-release@v1
69-
with:
70-
tag_name: ${{ github.ref_name }}
71-
name: Release ${{ github.ref_name }}
72-
draft: false
73-
prerelease: false
74-
files: ./dist/*.tgz
50+
# Install dependencies
51+
npm install -g pnpm
52+
pnpm install --frozen-lockfile
53+
54+
# Build
55+
if [ "$PKG_NAME" = "shared-configs" ]; then
56+
echo "Skipping build for @instructure.ai/shared-configs."
57+
else
58+
echo "Building package: $PKG_NAME"
59+
pnpm build package "$PKG_NAME"
60+
fi
61+
62+
# Test
63+
if [ "$PKG_NAME" = "shared-configs" ]; then
64+
echo "Skipping test for @instructure.ai/shared-configs."
65+
else
66+
pnpm test
67+
fi
68+
69+
# Publish
70+
if [ "$PKG_NAME" = "shared-configs" ]; then
71+
echo "Skipping publish for @instructure.ai/shared-configs."
72+
else
73+
pnpm publish
74+
fi
75+
76+
# Create GitHub release using gh CLI
77+
gh release create "$TAG" ./dist/*.tgz --title "Release $TAG" --notes "Automated release of $TAG"
78+
done
79+
env:
80+
tags: ${{ env.tags }}

0 commit comments

Comments
 (0)