Skip to content

Commit c101ee9

Browse files
Merge pull request #32 from lukewilliamboswell/simplify-release-workflow
Simplify release workflow
2 parents 07e9c52 + 26620e2 commit c101ee9

2 files changed

Lines changed: 6 additions & 105 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,8 @@ jobs:
113113
- test-bundle
114114
runs-on: ubuntu-24.04
115115
if: github.event_name == 'workflow_dispatch'
116-
outputs:
117-
release_commit: ${{ steps.prepare_release.outputs.release_commit }}
118-
release_tag: ${{ steps.prepare_release.outputs.release_tag }}
119116
permissions:
120117
contents: write
121-
pull-requests: write
122118
defaults:
123119
run:
124120
shell: bash
@@ -141,125 +137,30 @@ jobs:
141137
with:
142138
version: nightly-new-compiler
143139

144-
- name: Prepare release docs and examples
145-
id: prepare_release
140+
- name: Validate release version
141+
id: release_version
146142
env:
147-
BUNDLE_FILENAME: ${{ needs.build-bundle.outputs.bundle_filename }}
148143
RAW_RELEASE_VERSION: ${{ github.event.inputs.release_version }}
149-
REF_TYPE: ${{ github.ref_type }}
150-
GH_TOKEN: ${{ github.token }}
151144
run: |
152-
if [ "$REF_TYPE" != "branch" ]; then
153-
echo "Release workflow must be run from a branch."
154-
exit 1
155-
fi
156-
157-
SOURCE_COMMIT=$(git rev-parse HEAD)
158145
RELEASE_VERSION="${RAW_RELEASE_VERSION#v}"
159146
if [[ ! "$RELEASE_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
160147
echo "Release version must use x.y.z format, e.g. 0.11.0"
161148
exit 1
162149
fi
163150
164-
RELEASE_TAG="$RELEASE_VERSION"
165-
BUNDLE_URL="https://github.com/lukewilliamboswell/roc-parser/releases/download/${RELEASE_TAG}/${BUNDLE_FILENAME}"
166-
set +e
167-
python3 ci/update_example_parser_url.py "$BUNDLE_URL"
168-
UPDATE_STATUS=$?
169-
set -e
170-
171-
if [ "$UPDATE_STATUS" -eq 2 ]; then
172-
echo "Example package URLs are already current."
173-
elif [ "$UPDATE_STATUS" -ne 0 ]; then
174-
exit "$UPDATE_STATUS"
175-
fi
176-
177-
DOCS_ROOT=www ./docs.sh "$RELEASE_VERSION"
178-
179-
git config user.name "github-actions[bot]"
180-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
181-
git add examples www
182-
183-
if git diff --cached --quiet; then
184-
echo "Release docs and example URLs are already current."
185-
else
186-
RELEASE_ARTIFACTS_BRANCH="release-artifacts/${RELEASE_VERSION}"
187-
git commit -m "Prepare ${RELEASE_VERSION} release artifacts"
188-
git push --force-with-lease origin HEAD:"$RELEASE_ARTIFACTS_BRANCH"
189-
190-
PR_NUMBER=$(gh pr list \
191-
--base "${{ github.ref_name }}" \
192-
--head "$RELEASE_ARTIFACTS_BRANCH" \
193-
--state open \
194-
--json number \
195-
--jq '.[0].number // empty')
196-
197-
if [ -z "$PR_NUMBER" ]; then
198-
gh pr create \
199-
--base "${{ github.ref_name }}" \
200-
--head "$RELEASE_ARTIFACTS_BRANCH" \
201-
--title "Prepare ${RELEASE_VERSION} release artifacts" \
202-
--body "Generated docs and updated example package URLs for release ${RELEASE_VERSION}."
203-
else
204-
gh pr comment "$PR_NUMBER" \
205-
--body "Updated generated docs and example package URLs for release ${RELEASE_VERSION}."
206-
fi
207-
fi
208-
209-
echo "release_commit=$SOURCE_COMMIT" >> "$GITHUB_OUTPUT"
210-
echo "release_tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT"
211-
212-
- name: Upload generated docs artifact
213-
uses: actions/upload-artifact@v4
214-
with:
215-
name: release-docs
216-
path: www
217-
retention-days: 30
151+
echo "release_tag=$RELEASE_VERSION" >> "$GITHUB_OUTPUT"
218152
219153
- name: Create release
220154
env:
221155
GH_TOKEN: ${{ github.token }}
222156
run: |
223157
BUNDLE_FILE="dist/${{ needs.build-bundle.outputs.bundle_filename }}"
224158
ROC_VERSION=$(roc version)
225-
TARGET_COMMIT="${{ steps.prepare_release.outputs.release_commit }}"
226-
RELEASE_TAG="${{ steps.prepare_release.outputs.release_tag }}"
159+
RELEASE_TAG="${{ steps.release_version.outputs.release_tag }}"
227160
228161
gh release create "$RELEASE_TAG" \
229162
"$BUNDLE_FILE" \
230-
--target "$TARGET_COMMIT" \
163+
--target "${{ github.sha }}" \
231164
--title "$RELEASE_TAG" \
232165
--generate-notes \
233166
--notes "Parser package bundle built with Roc $ROC_VERSION."
234-
235-
deploy-docs:
236-
name: Deploy docs
237-
needs: create-release
238-
runs-on: ubuntu-latest
239-
if: github.event_name == 'workflow_dispatch'
240-
permissions:
241-
contents: read
242-
pages: write
243-
id-token: write
244-
environment:
245-
name: github-pages
246-
url: ${{ steps.deployment.outputs.page_url }}
247-
248-
steps:
249-
- name: Download generated docs artifact
250-
uses: actions/download-artifact@v4
251-
with:
252-
name: release-docs
253-
path: ./www
254-
255-
- name: Setup Pages
256-
uses: actions/configure-pages@v5
257-
258-
- name: Upload docs artifact
259-
uses: actions/upload-pages-artifact@v3
260-
with:
261-
path: "./www"
262-
263-
- name: Deploy to GitHub Pages
264-
id: deployment
265-
uses: actions/deploy-pages@v4

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ CI skips `examples/markdown.roc` because the latest Roc nightly overflows the co
4545

4646
Bundle the package for distribution using `scripts/bundle.sh --output-dir dist`.
4747

48-
Run the release workflow from GitHub Actions with a release version such as `0.11.0`. It builds and tests the bundle, creates the GitHub release, deploys generated docs to GitHub Pages, and opens a release-artifacts PR with updated example package URLs plus the generated `www/` docs.
48+
Run the release workflow from GitHub Actions with a release version such as `0.11.0`. It builds and tests the bundle, then creates the GitHub release. Update example package URLs and generated `www/` docs in a follow-up PR.

0 commit comments

Comments
 (0)