feat(static-site): publish v0.3.2 (#35) #46
Workflow file for this run
This file contains hidden or 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: Release Recipe | |
| on: | |
| push: | |
| tags: | |
| - "rust-v*" | |
| - "motoko-v*" | |
| - "asset-canister-v*" | |
| - "prebuilt-v*" | |
| - "static-site-v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| release-recipe: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 0 # Fetch all history and tags | |
| - name: Extract recipe and version from tag | |
| id: tag_info | |
| run: | | |
| TAG=${GITHUB_REF#refs/tags/} | |
| RECIPE=$(echo "$TAG" | sed 's/-[^-]*$//') | |
| VERSION=$(echo "$TAG" | sed 's/^.*-//') | |
| # Pass the recipe name and version along | |
| echo "recipe=$RECIPE" >> "$GITHUB_OUTPUT" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Package Recipe | |
| run: | | |
| mkdir -p release | |
| # Copy individual recipe files | |
| cp recipes/${{ steps.tag_info.outputs.recipe }}/recipe.hbs release/ | |
| # Create archives | |
| tar -czf release/${{ steps.tag_info.outputs.recipe }}-${{ steps.tag_info.outputs.version }}.tar.gz recipes/${{ steps.tag_info.outputs.recipe }}/ | |
| zip -r release/${{ steps.tag_info.outputs.recipe }}-${{ steps.tag_info.outputs.version }}.zip recipes/${{ steps.tag_info.outputs.recipe }}/ | |
| - name: Generate Checksums | |
| run: | | |
| cd release | |
| sha256sum * > checksums.txt | |
| - name: Find previous recipe version | |
| id: prev_version | |
| run: | | |
| RECIPE="${{ steps.tag_info.outputs.recipe }}" | |
| CURRENT_TAG="${GITHUB_REF#refs/tags/}" | |
| # For versioned tags: find the previous version tag | |
| PREV_TAG=$(git tag --sort=-version:refname -l "${RECIPE}-v*" | grep -v "${CURRENT_TAG}" | head -n 1) | |
| if [ -z "$PREV_TAG" ]; then | |
| echo "No previous version found for ${RECIPE}" | |
| echo "previous_tag=" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Found previous tag: ${PREV_TAG}" | |
| echo "previous_tag=${PREV_TAG}" >> "$GITHUB_OUTPUT" | |
| fi | |
| echo "compare_tag=${CURRENT_TAG}" >> "$GITHUB_OUTPUT" | |
| - name: Generate Release Notes Body | |
| id: release_notes | |
| run: | | |
| RECIPE="${{ steps.tag_info.outputs.recipe }}" | |
| PREV_TAG="${{ steps.prev_version.outputs.previous_tag }}" | |
| COMPARE_TAG="${{ steps.prev_version.outputs.compare_tag }}" | |
| if [ -n "$PREV_TAG" ] && [ -n "$COMPARE_TAG" ]; then | |
| echo "## What's Changed" > release_notes.md | |
| echo "" >> release_notes.md | |
| # Get commits that affect this recipe's directory | |
| COMMITS=$(git log ${PREV_TAG}..${COMPARE_TAG} --pretty=format:"* %s (%h)" --no-merges -- recipes/${RECIPE}/) | |
| if [ -n "$COMMITS" ]; then | |
| echo "Changes since ${PREV_TAG}:" >> release_notes.md | |
| echo "" >> release_notes.md | |
| echo "$COMMITS" >> release_notes.md | |
| echo "" >> release_notes.md | |
| else | |
| echo "No changes to the ${RECIPE} recipe files." >> release_notes.md | |
| echo "" >> release_notes.md | |
| fi | |
| echo "" >> release_notes.md | |
| echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${COMPARE_TAG}" >> release_notes.md | |
| else | |
| echo "## What's Changed" > release_notes.md | |
| echo "" >> release_notes.md | |
| echo "Initial release of the ${RECIPE} recipe." >> release_notes.md | |
| fi | |
| - name: Create Release | |
| uses: softprops/action-gh-release@aec2ec56f94eb8180ceec724245f64ef008b89f5 # v2.4.0 | |
| with: | |
| tag_name: ${{ steps.tag_info.outputs.recipe }}-${{ steps.tag_info.outputs.version }} | |
| name: ${{ steps.tag_info.outputs.recipe }} ${{ steps.tag_info.outputs.version }} | |
| files: release/* | |
| body_path: release_notes.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |